Sitemap generator
refs: #63
A simple shell script could make the job.
@jakubvokoun do you think you could put this script inside the CI folder? I think it fits better there.
@ericonr No problem. Should I also add i to .travis.yml?
script:
- ci/format.sh
- ci/sitemap.sh
Hmm, thought I'd answered this some time ago. This won't work as written because it won't ever be run on production infrastructure. There would need to be a fix somewhere in the scriptlets that build the site unless mdbook has suddenly gained a hooks subsystem on build.
@the-maldridge so we'd need to make some modification to the ansible roles for this to run the way it is now? I can look into mdbook a bit further.
@jakubvokoun Adding it to travis wouldn't hurt, and would help verify the script isn't malfunctioning for some reaon. I'm waiting on https://github.com/void-ansible-roles/mdbook/pull/1, after it's merged I can try to add this there as well.
It'd be necessary to add a bit more logic to your script a well. If you add [mdbook.linkcheck] to book.toml (which I want to do, as it allows checking links in CI), the book output goes into book/html/ instead of book/. Ideally, I'd like to support both of these scenarios.
@jakubvokoun the script needs to support the output directory being in book/ or book/html/. Do you think you could look into adding that, please?
With support for that, we can look into adding it to the ansible role. :D
@Duncaen: Do you feel a sitemap is still needed for accessibility purposes? The sidebar seems to essentially be a sitemap, and can be tabbed through (after first tabbing through the navbar).
In a conversation on IRC, @Duncaen indicated he'd like a page with links to each section of the Handbook, accompanied by when that section was last updated.
i'd like to set aside presentation issues for now, and discuss the generation of this content.
We could manually create the content: each commit involving changes to Handbook content would also have to include not only any relevant changes to SUMMARY.md, but also make record the change date in (say) sitemap.md.
We could instead try to auto-generate the content. It's easy enough to write a script to go through SUMMARY.md and run something like:
git log -n1 --format=format:"%ai" src/about/index.md
on each file, to produce dates and times. However, it seems to me that if we try to do this prior to the deployment process for docs.voidlinux.org, we would end up needing two distinct commits: one for the change to the content, and one that uses the log data from the first commit to update sitemap.md appropriately.
One way we might be able to work around would be to make sitemap.md a placeholder page; its content would be generated during the deployment process by getting git log data at that point.
Thoughts/comments on all this?
@jakubvokoun the script needs to support the output directory being in
book/orbook/html/. Do you think you could look into adding that, please?
Now you can set output directory using env variable, default vaule is book/.
mdbook has suddenly gained a hooks subsystem on build
sorry for necroposting, but this should now be possible, see (minimal) docs here and example here. The "API" for custom preprocessors is json, so a sitemap preprocessor could use jq/python/etc to generate it. You may not even need to deal with the json input if you aren't reading/changing the content aside from adding the sitemap (just pipe it through).
The current script would probably be not very hard to adapt as a preprocessor