tlienart / Franklin.jl

(yet another) static site generator. Simple, customisable, fast, maths with KaTeX, code evaluation, optional pre-rendering, in Julia.
https://franklinjl.org
MIT License
932 stars 108 forks source link

Option to set sitemap filename #1047

Closed mortenpi closed 9 months ago

mortenpi commented 9 months ago

We need to rename the sitemap.xml file for a Franklin site. We can just rename the file after the build, but it would be convenient if Franklin could do it for us. Would it be reasonable to have an option for this, e.g. sitemap_filename, that would default to sitemap.xml, but could be customized?

I'd be happy to look into a PR for this, but I could use some pointers to understand the codebase. I see it's currently hard-coded in these two places:

https://github.com/tlienart/Franklin.jl/blob/f1f7d044dc95ba0d9f368a3d1afc233eb58a59cf/src/manager/robots_generator.jl#L30

https://github.com/tlienart/Franklin.jl/blob/f1f7d044dc95ba0d9f368a3d1afc233eb58a59cf/src/manager/sitemap_generator.jl#L70

Would it be as easy as just adding a globvar(:sitemap_file) call to those places?

tlienart commented 9 months ago

Would it be as easy as just adding a globvar(:sitemap_file) call to those places?

yes! and adding a sitemap_file here with default: https://github.com/tlienart/Franklin.jl/blob/f1f7d044dc95ba0d9f368a3d1afc233eb58a59cf/src/utils/vars.jl#L49