Skip to content

Commit

Permalink
made sure that the timestamps in the sitemap are all conforming to wh…
Browse files Browse the repository at this point in the history
…at google expects
  • Loading branch information
CommanderStorm committed Apr 7, 2024
1 parent 66f0c76 commit 53f078d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/processors/sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _write_sitemapindex_xml(fname: Path, sitemaps: Sitemaps) -> None:
loc.text = f"https://nav.tum.de/cdn/sitemap-data-{name}.xml"
if lastmod_dates := {site["lastmod"] for site in sitemap if "lastmod" in site}:
lastmod = ET.SubElement(sitemap_el, "lastmod")
lastmod.text = max(lastmod_dates).isoformat(timespec="seconds") + "Z"
lastmod.text = max(lastmod_dates).isoformat(timespec="seconds")

# Because sitemaps cannot be hierarchical, we have to include the
# webclient sitemap here as well.
Expand All @@ -218,7 +218,7 @@ def _write_sitemapindex_xml(fname: Path, sitemaps: Sitemaps) -> None:
sitemap = _download_online_sitemap(web_sitemap_url)
if lastmod_dates := set(sitemap.values()):
lastmod = ET.SubElement(sitemap_el, "lastmod")
lastmod.text = max(lastmod_dates).isoformat(timespec="seconds") + "Z"
lastmod.text = max(lastmod_dates).isoformat(timespec="seconds")

root = ET.ElementTree(sitemapindex)
root.write(fname, encoding="utf-8", xml_declaration=True)

0 comments on commit 53f078d

Please sign in to comment.