Closed (fixed)
Project:
Tome
Version:
8.x-1.0-alpha2
Component:
Tome Static
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Nov 2018 at 13:19 UTC
Updated:
6 Jan 2019 at 17:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
samuel.mortenson@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.
Comment #3
badzilla commentedCheers 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):
What are your thoughts on this?
Cheers :)
Comment #4
samuel.mortenson@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.xmlfile. 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.
Comment #5
badzilla commentedThanks Samuel for your detailed response. You've confirmed my own thoughts! I'll document my chosen option in my next blog.
Comment #6
samuel.mortensonComment #7
samuel.mortensonHere'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.
Comment #8
samuel.mortensonThis 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.
Comment #10
samuel.mortensonRe-roll.
Comment #12
samuel.mortensonComment #13
samuel.mortensonThis is going OK, but I don't think it's stable enough for beta1.
Comment #14
badzilla commentedHey 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 :)
Comment #15
samuel.mortensonFixed caching, looks like there's a bug in how placeholdered paths are added to cache in beta1.
Comment #16
samuel.mortensonMore tweaks.
Comment #18
samuel.mortensonLet's get this in! It's not perfect but I've tested it a bit and seems to work OK.