Configure & Fix Pelican Sitemap Error on Google Search Console
TL;DR - Set the SITEURL variable in
publishconf.py and use
publishconf.py to generate your website instead of the default
pelicanconf.py. This will fix your Google Search Console sitemap error.
If you have have recently started using Pelican and have struggled with it comprehensive but incoherent documentation. One of the problems you might encounter is handing the SITEURL errors both while working on your local system and on the deployed webserver.
What is SITEURL?
Pelican's SITEURL refers to the URL of your website, e.g. example.com, or blog.example.com. In our website's case the SITEURL is "https://cloudbytes.dev".
Pelican needs the SITEURL to define the
href links in your website correctly while publishing the website.
How to define SITEURL?
Make sure it is configured correctly in two places
pelicanconf.py: This file is typically used for local development. Running
invoke livereloaduses this file by default.
publishconf.py: The setting in this file overrides the ones in
pelicanconf.pyand is meant for generating the static website for deployment. But Pelican doesn't use this by default. You need to run either
pelican content -s publishconf.pyor
make publishto use this file as your settings.
Errors that you may encounter
If you don't configure SITEURL correctly the website will work on your system but not on the hosting provider you are using for your final website.
Typically you may encounter the below error
This is due to malformed URLs, and the typical reason is incorrect SITEURL configuration.