RSS feeds are not being generated when using the View Taxonomy term (Content). A quick investigation suggests this happens when the terms have a route assigned to them although this is guesswork and there may be other circumstances at play.

To reproduce:
1. Create a new vocabulary. Call it eg. 'CMS'
2. Create two new terms 'wordpress' and 'drupal' with routes /wordpress and /drupal
3. Add a taxonomy field to a content type using 'CMS'
4. Assign the terms wordpress and drupal to some content.
5. Generate the static site with tome:static
6. Check that html is created in /html/wordpress/ and /html/drupal/ - it will be.
7. Check the rss feeds are created in /taxonomy/term/%/feed - won't be.

Comments

badzilla created an issue. See original summary.

samuel.mortenson’s picture

@badzilla Yeah this one is tricky - Tome doesn't generate every version of a route if it contains a parameter (i.e. /node/%/foobar) because that's both a non-trivial operation (you would need to load the View, iterate over contextual filters, etc.), and could lead to many paths being generated that are never used.

Long term we could have users opt-in to auto-generating paths for routes that use parameters/patterns, but in the short term you can create an event subscriber that tells the static generator what paths are available. An example event subscriber for this is https://cgit.drupalcode.org/tome/tree/modules/tome_static/src/EventSubsc..., which is what currently tells Tome about all the non-entity-routes on the site.

badzilla’s picture

Cheers for the response Samuel.

I suspect there's a side issue with this which manifests on my Drupal Planet RSS feed. I have that at /planet/feed. When I generate the static site, a directory /planet/feed is created and the feed.rss becomes index.html. The index.html actually contains the rss feed and since it's presented in html format it becomes totally mangled.

Now if I apply your suggested solution to /taxonomy/term/%/feed routes I think the identical problem as the Planet Feed above will manifest. All the rss feeds will be index.html.

The workaround I can think of would be to have a post tome:static script that renames all the feeds to feed.rss, and to ensure that the Apache / nginx config has (nginx example shown):

index index.html feed.rss;

What are your thoughts on this?

Cheers :)

samuel.mortenson’s picture

@badzilla If you provide Tome with a path that includes an extension like /planet/feed.xml, it should check if the path exists as a local file (which it won't), then make a request to Drupal for that content, then create an actual .xml file. The only time Tome creates index.html files is when the current path has no extension (ref https://cgit.drupalcode.org/tome/tree/modules/tome_static/src/StaticGene...).

Edit: Looking at your site now, I see that http://www.badzilla.co.uk/planet/feed returns an RSS response but the path doesn't have an extension - not sure if there's a simple solution here. Tome generates static sites that can be hosted anywhere - which means that if you have a path like /planet/feed it has to have a file like /planet/feed/index.html to be properly delivered to clients. Tome can't include rewrite rules that say "/planet/feed should deliver /planet/feed/feed.xml" that would generically work on all static hosting platforms.

So long story short, I think your options are:

1. See if you can change your RSS feed path so that it ends in an extension - this should just work.
2. After tome:static runs, perform a copy as you were mentioning - you would still need rewrite rules in this case I think.
3. Change nothing, but add rewrite rules for your hosting platform to deliver the proper content type (rss+xml) for these paths. The client wouldn't care that they're "really" seeing the response from index.html.

badzilla’s picture

Thanks Samuel for your detailed response. You've confirmed my own thoughts! I'll document my chosen option in my next blog.

samuel.mortenson’s picture

Title: tome:static does not generate Views taxonomy rss feeds correctly » Paths should be derived for Views with contextual filters
Component: Code » Tome Static
samuel.mortenson’s picture

StatusFileSize
new19.73 KB

Here's where I started going with this, but this is so technically complex that I think I'm just going to go with traditional crawling - if you link to a path that Tome isn't already aware of, it will generate HTML for that path.

Just uploading this wrong-direction patch for my own reference.

samuel.mortenson’s picture

Status: Active » Needs review
StatusFileSize
new5.46 KB

This seems much better, and like something I want to maintain.

@badzilla would you mind testing this out and letting me know if all your term feeds are picked up? Note that you would still need to edit your feed view path to end in .rss to get it rendered properly.

Status: Needs review » Needs work

The last submitted patch, 8: 3011732-8.patch, failed testing. View results

samuel.mortenson’s picture

Status: Needs work » Needs review
StatusFileSize
new5.47 KB

Re-roll.

Status: Needs review » Needs work

The last submitted patch, 10: 3011732-10.patch, failed testing. View results

samuel.mortenson’s picture

Status: Needs work » Needs review
StatusFileSize
new5.95 KB
new961 bytes
samuel.mortenson’s picture

StatusFileSize
new7.09 KB
new2.75 KB

This is going OK, but I don't think it's stable enough for beta1.

badzilla’s picture

Hey Samuel - apologies I dropped off for a couple of weeks whilst looking at the Elasticsearch side of my project and travelling to Ghent for Drupal Camp Belgium.

I'll have a look over the weekend :)

samuel.mortenson’s picture

StatusFileSize
new7.96 KB
new2.55 KB

Fixed caching, looks like there's a bug in how placeholdered paths are added to cache in beta1.

samuel.mortenson’s picture

StatusFileSize
new10.19 KB
new4.47 KB

More tweaks.

  • samuel.mortenson authored 824fd2b on 8.x-1.x
    Issue #3011732 by samuel.mortenson, badzilla: Paths should be derived...
samuel.mortenson’s picture

Status: Needs review » Fixed

Let's get this in! It's not perfect but I've tested it a bit and seems to work OK.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.