pelican-plugins / sitemap

Generates a site map for Pelican-powered sites
50 stars 11 forks source link

Wrong sitemap when using save_as keyword in page #24

Closed orontee closed 1 year ago

orontee commented 1 year ago

When a page as a save_as keyword with value index.html, it's entry in the sitemap may refer to the wrong location.

Example

See first entry of the sitemap generated with tag v1 of https://github.com/orontee/lesmotsdugene refers to the URL https://lesmotsdugene.fr/pages/eugene-vicat-dit-le-gene.html but Pelican doesn't generate this resource. Note also that index.html is missing from the sitemap.

Source code of the index.html page: https://github.com/orontee/lesmotsdugene/blob/v1/content/pages/eugene-vicat-dit-le-gene.md with save_as keyword on line 7.

(Edit: I've updated the exclude config of the plugin to fix the wrong URL but index.html is still missing...)

Details

Python 3.11.2 under Debian Bookworm in virtual environment with following packages installed:

blinker==1.6.2
docutils==0.19
feedgenerator==2.0.0
importlib-metadata==6.0.0
invoke==2.0.0
Jinja2==3.1.2
Markdown==3.4.1
markdown-it-py==2.2.0
MarkupSafe==2.1.2
mdurl==0.1.2
pelican==4.8.0
pelican-series==2.1.0
pelican-sitemap==1.0.2
Pygments==2.14.0
python-dateutil==2.8.2
pytz==2022.7.1
rich==13.3.1
six==1.16.0
text-unidecode==1.3
Unidecode==1.3.6
zipp==3.15.0
orontee commented 1 year ago

After reading https://docs.getpelican.com/en/latest/faq.html#how-can-i-override-the-generated-url-of-a-specific-page-or-article I tried to add an empty Url metadata in the page at the origin of the problem and the sitemap now looks good.

I may have misunderstood the documentation, not clear to me. Feel free to close this issue if the behavior I described is expected.

avaris commented 1 year ago

if the behavior I described is expected.

I don't know from this plugin side, but from pelican side: yes it's expected. URL for a file is very much dependent on the how the site is served so pelican stays away from trying to guesstimate any value. So if you specify SAVE_AS, you are expected to define a compatible URL as well (and vice versa).

justinmayer commented 1 year ago

@orontee: I hope the answer @avaris provided was helpful and that you are finding the Sitemap plugin to be useful. 😊