Dynamic sitemap.xml for Steemdocs.net
- What feature(s) did you add?
Steemdocs.net needed a solution for generating a dynamic
sitemap.xml file in order the https://steemdocs.net to be indexed by the search engines.
Considering a nature of the project, it is really critical for the site content to be "searchable" by people using modern search engines.
Why it should be generated dynamically?
Well, more and more content is being added to steemdocs.net, so we do not now want to update
sitemap.xml manually each time, right?
More about the issue described by @cryptoctopus in his feature request here: https://steemit.com/steemdocs/@cryptoctopus/steemdocs-net-bounty-dynamic-sitemap-xml-50-steem-upvote-from-utopian-and-me
The change is already on production, so you can see a result of the contribution here:
- How did you implement it/them?
In a first step, I just prepared a simple script, which does the thing:
vuepress internal file (
node_modules/vuepress/lib/app/.temp/siteData) includes a list of generated ( during a build process ) sites. What we need to do is simply take the file content, and generate
sitemap.xml with a proper structure based on that. A
sitemap package was used, to generate XML file.
The script was STRONGLY based on already existing sitemap-generator plugin for
vuepress based projects (https://github.com/ekoeryanto/vuepress-plugin-sitemap)
Unfortunately, the plugin could not have been used within the
steemdocs project, due to non-existing ( at the time ) support for latest
The issue was posted here: https://github.com/ekoeryanto/vuepress-plugin-sitemap/issues/1
Thanks God, open-source community is responsive, so in the next few hours an author of the plugin has published a new version. I could finally take an advantage of his work, and link the plugin with the
steemdocs repo. Custom script (presented above) was no longer needed, as the plugin did the job out-of-the-box.
Simple project build (
npm run build) forces plugin to run and generate
sitemap.xml to be created in an output directory.
Basic plugin configuration requires site host to be specified:
Two Unit Tests has been added in order to check the very basics of the generated
It would be really nice to see even more people contribution to such a great project - steemdocs.net.