Add to Pelican - Sitemap and Robots.txt

By Brad Lazaruk, Sun 11 September 2022, in category Web development

GitHub, Netlify, Pelican, Pelican Plugins, Python, Sitemap

Finally with some more time on my hands I fixed up the last bit of the site migration from Wordpress to Pelican: adding the sitemap and robots.txt file.

The robots.txt file was easy, as this is a static file in the first place. Just create the file in /content/extra and on the next build it will be available in the output.

The sitemap is a bit more involved. Fortunately, there’s a plugin for that.

  1. Add the sitemap plugin to your environment.
python -m pip install pelican-sitemap
  1. Update your requirements.txt so the deployments to other environments, like Netlify when this is published, also add the plugin.
pip freeze > requirements.txt
  1. Add the configuration of the plugin to file.
    SITEMAP = {
    "format": "xml",
    "priorities": {
        "articles": 0.5,
        "indexes": 0.5,
        "pages": 0.5
    "changefreqs": {
        "articles": "monthly",
        "indexes": "daily",
        "pages": "monthly"
    "exclude": ["tag/", "category/", "author/"]

And … that’s that. Super easy. Pelican is great.