Generate sitemaps from programmatically collected URLs.
- Adheres to Sitemap Protocal as defined at https://www.sitemaps.org/protocol.html
- Generates an index that points to compressed sitemaps files
- each generated sitemap won't have more than the allowed amount (50.000 URLs)
- jinja2 templates
pip install sitemap-builder
- Import
from sitemap import Sitemap
- Initialize
sitemap = Sitemap()
- Add urls to process them later:
sitemap.add_item("dummy-page")
sitemap.add_item("another-page")
sitemap.add_item("category/foo-bar")
- Generate sitemap index and files
sitemap.generate()
Generated files:
.
├── sitemap.xml
└── sitemaps
├── sitemap-0.xml.gz
├── sitemap-1.xml.gz
├── sitemap-2.xml.gz
└── sitemap-3.xml.gz
virtualenv -p /usr/bin/python3.6 ~/.virtualenvs/sitemap-builder
Activate it
workon sitemap-builder
make install