wagtail-nest / wagtail-bakery

A set of helpers for baking your Django Wagtail site out as flat files.
MIT License
182 stars 40 forks source link

Add option to order pages during build #61

Closed nesvoboda closed 3 years ago

nesvoboda commented 3 years ago

Hi and big thanks for your work on this beautiful tool!

I have a problem where the main page is built before the other pages. A link to a sub-page appears on the main page, but the new sub-page is not built yet. This results in 404s for a first dozen of seconds after a subpage gets published.

The solution might be to let users select how the pages will be ordered during a build. I would also suggest to build the latest published pages first, because menus/main pages tend to be created before all other pages.

What do you think? I only suggest this because I haven't found a workaround.

gasman commented 3 years ago

Hi @nesvoboda, Presumably this only happens if you're generating pages directly into the location where they're being served? If so, a suitable workaround would be to generate into a temporary location, and copy everything into the final location once it's done.

I'm pretty sure this matches the most common setup of wagtail-bakery - typically the page generation would happen on a separate machine to the webserver, so that the webserver doesn't have to run Python at all (and could even be a static file host such as Amazon S3).

nesvoboda commented 3 years ago

Hi @gasman,

Yeah, it sounds like a good workaround, thanks! Yes, that's right, the files were served directly out of the build folder.