algoo / jfmengine

A soft fork of JSSG for algoo websites use case
Other
0 stars 0 forks source link

add lastmod information to generated sitemap.xml #14

Closed lebouquetin closed 2 months ago

lebouquetin commented 3 months ago

Currently, the mechanism generates a sitemap.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.galae.net/pages/page1.html</loc>
  </url>
  [...]
</urlset>

Expected: add the tag based on the last modification of the content.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.galae.net/pages/page1.html</loc>
    <lastmod>2004-12-23T18:00:15+00:00</lastmod>
  </url>
  [...]
</urlset>

Note: sitemap lastmod datetime format should be parametric and configured in settings.py

JFME_SITEMAP_LASTMOD_DATETIME_FORMAT = "xxx"  # xxx to be changed to the right format even in the default settings.py example

See https://www.sitemaps.org/protocol.html#lastmoddef for allowed datetime format.

ClmntBcqt commented 2 months ago

Merged in #45