Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option sitemap_lastmod #94

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

berhoel
Copy link

@berhoel berhoel commented Aug 13, 2024

I added a configuration option to generate lastmod entries for the urls.

The Option can either be set to True (current date is used) or a string with the desired lastmod date.

I introduced another small patch in adding {posargs} to the pytest call in tox.ini, which allows specifying additional command line options for the pytest call when starting tox .

This option adds the "lastmod" entries to the "sitemap.xml" "url" entries.
This allows to specify additional command line arguments for pytest
with the tox call.
@jdillard
Copy link
Owner

Thanks!

The Option can either be set to True (current date is used) or a string with the desired lastmod date.

I'm not the biggest fan of having a variable be multiple types. What do you think of making the user configure their conf.py as something like:

sitemap_lastmod = "2024-08-13"
# or
import datetime
sitemap_lastmod = f"{datetime.datetime.now():%Y-%m-%d}"

@berhoel
Copy link
Author

berhoel commented Aug 20, 2024

Fair enough, I modified the pull request accordingly.

@jdillard
Copy link
Owner

Hrm, I'm kind of torn on this implementation. I looked up "best practices" for lastmod and found some information on how it should be used:

Note that the date must be set to the date the linked page was last modified, not when the sitemap is generated.

Source: https://www.sitemaps.org/protocol.html

As well as potential consequences for misusing it:

Google appears to store "last significant update" time/date in epoch format for URLs. You can supply lastmod in XML sitemap. Google has boolean on whether to trust you or not based on whether you're a naughty liar

Source: https://www.seroundtable.com/google-sitemap-lastmod-binary-trust-37554.html

I'm not sure I want to promote a method that has the potential to lose trust with search engines. This was why I would prefer to use Git information to determine the last modified date for each page: #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants