Cybrkyd's git repositories

page-with-py • commit: dfdbad6

commit dfdbad6fc08f7dedd6c0a7f4b7d0f32a902f407cddcef1975e402025f2da6a10
author cybrkyd <vii@cybrkyd.com> 2025-10-14 15:07:02 +0100
committer cybrkyd <vii@cybrkyd.com> 2025-10-14 15:07:02 +0100
v1.4

Commit Message

- V1.4
- Removed <lastmod> from sitemap generation
- It is not a mandatory requirement and is unlikely to be very useful in a blog website situation.

📊 Diffstat

pa-py/pa.py 10
1 files changed, 1 insertions(+), 9 deletions(-)

Diff

diff --git a/pa-py/pa.py b/pa-py/pa.py
index 57c863d..0b21c81 100644
--- a/pa-py/pa.py
+++ b/pa-py/pa.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
PaPy (Page with Python): a Python static site generator
- v1.3
+ v1.4
"""
import re
@@ -546,14 +546,6 @@ def generate_sitemap(pages, output_dir: Path):
for page in pages:
url = ET.SubElement(urlset, 'url')
ET.SubElement(url, 'loc').text = page['url']
- try:
- date_str = page['date']
- if re.search(r'[+-]\d{4}$', date_str):
- date_str = date_str[:-2] + ':' + date_str[-2:]
- lastmod = datetime.fromisoformat(date_str).strftime('%Y-%m-%d')
- except Exception:
- lastmod = datetime.now().strftime('%Y-%m-%d')
- ET.SubElement(url, 'lastmod').text = lastmod
tree = ET.ElementTree(urlset)
ET.indent(tree, space=" ", level=0)