A static site sitemap generator that sets lastmod based on content hash (not just file modification time). This script was created to update the page modification date in the sitemap only when the content actually changes. Many tools (in particular, Git clients) may alter file timestamps without changing the content, which would otherwise cause false updates in the sitemap.
- Configurable include/exclude file masks
- Configurable
changefreqandpriority - URL aliasing — for example, mapping
<loc>https://example.com/index.html</loc>to<loc>https://example.com/</loc> - Automatic generation of nested
image:imageelements withlocandtitlederived from thealttext
- Edit
config.json: set the correctbase_diranddomain. Review and adjust file masks and other settings according to your site's structure. By default, the file contains only example configurations. - Run
sitemap_gen.py. It will generatesitemap.xmlin the site directory and save file hashes infile_info.json(in the script's folder) for use in future incremental updates. - Run the script from the command line for the first time to catch any generation errors. Most common issues arise from JSON syntax errors in
config.jsonafter editing.
- Tested only on Windows
- Files with zero size are automatically excluded, even if they match the filter (this is used by
ksdbmerge.toolsto skip S3 redirects; and in general, indexing empty files is not recommended) - Images are only included if they appear after an
H1tag — this ensures only meaningful content images are added, excluding header icons and navigation elements. - Currently used to generate the sitemap for ksdbmerge.tools
This tool fully covers the functionality it was designed for.
At the moment, no new features are planned, and we do not accept pull requests for extending its functionality.
If you need any fixes or additional features, feel free to fork the repository and adapt it to your needs.