commit 371d331ae204c0e6890e753d00e61628019337cd parent 57e45c4b9f7f6bf426cc8fe14461aecdd0aa8ee1 Author: Hugo Soucy <hugo@soucy.cc> Date: Wed, 30 Nov 2022 14:11:13 -0500 Sort by the time_modification field Diffstat:
M | templates/sitemap.xml.html | | | 4 | +++- |
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/templates/sitemap.xml.html b/templates/sitemap.xml.html @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <% if sitemap then %> - <!-- SITEMAPXML entries should be sort by the lastmod field --> + <!-- Sort by the time_modification field --> + <% table.sort(sitemap, function(a, b) return tonumber(a.time_modification) > tonumber(b.time_modification) end) %> + <% for i = 1, #sitemap do %> <url> <loc><%= sitemap[i].permalink -%></loc>