mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-18 17:33:30 -05:00
fix: date sitemap entries from their pages
The sitemap gave every page the build date. A page now states its own date and a mkdocs hook passes it on, or leaves lastmod out. The values added to the site's code spans today are also escaped: a backtick in a profile or file name could close the span and inject markup.
This commit is contained in:
1 parent
f5e3404a8d
commit
bd75defb61
7 files changed
+88
-7
No files matched your search
@@ -0,0 +1,17 @@
|
||||
"""MkDocs hooks for the generated site.
|
||||
|
||||
The sitemap gave all 664 pages the build date as lastmod, so the field told
|
||||
a crawler nothing. A page whose content carries its own date (an emulator
|
||||
page: the day its profile was last read against the source) states it in
|
||||
its front matter; the rest get no lastmod rather than an inexact one.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def on_page_markdown(markdown: str, page: Any, config: Any, files: Any) -> str: # noqa: ARG001
|
||||
"""Take lastmod from the page's own date, or leave it out."""
|
||||
page.update_date = str(page.meta.get("date_modified") or "")
|
||||
return markdown
|
||||
Reference in new issue
Block a user