Skip to content

feat(sitemap): add <lastmod> support with per-page timestamps#4480

Open
iitzIrFan wants to merge 12 commits intokestra-io:mainfrom
iitzIrFan:feat/sitemap-lastmod-support
Open

feat(sitemap): add <lastmod> support with per-page timestamps#4480
iitzIrFan wants to merge 12 commits intokestra-io:mainfrom
iitzIrFan:feat/sitemap-lastmod-support

Conversation

@iitzIrFan
Copy link
Copy Markdown
Contributor

@iitzIrFan iitzIrFan commented Apr 2, 2026

fixes: #4462


  • Added support for across all sitemap generators using a new formatLastMod() helper (ISO-8601 format).
  • Updated sitemap generation to include per-URL lastmod values from the best available source:
    • Frontmatter (updated / date)
    • API fields (updatedAt)
    • Filesystem mtime as fallback
  • Extended schemas where needed (e.g., added updated to docs).
  • Fixed a URLSearchParams.entries() iterator issue in layout.astro.

Tested with custom script which can be used for testing this PR,

const http = require('http');
const https = require('https');

const ports = [4321];

const endpoints = [
  '/sitemap/blogs.xml',
  '/sitemap/docs.xml',
  '/sitemap/blueprints.xml',
  '/sitemap/plugins.xml',
  '/sitemap/misc.xml',
];

const urls = ports.flatMap((p) =>
  endpoints.map((e) => `http://localhost:${p}${e}`)
);

const fetch = (url) =>
  new Promise((resolve) => {
    const client = url.startsWith('https') ? https : http;

    try {
      client
        .get(url, (res) => {
          let data = '';

          res.on('data', (chunk) => (data += chunk));
          res.on('end', () => resolve(data));
        })
        .on('error', () => resolve(null));
    } catch {
      resolve(null);
    }
  });

(async () => {
  for (const url of urls) {
    const response = await fetch(url);

    if (response === null) {
      console.error('ERROR', url);
      continue;
    }

    const matches = response.match(/<lastmod>.*?<\/lastmod>/g) || [];
    const unique = [...new Set(matches)];

    console.log(
      url,
      `count=${matches.length}`,
      `unique=${unique.length}`
    );

    if (unique.length > 0) {
      console.log(' sample:', unique.slice(0, 3).join(' | '));
    }
  }
})();

ref. #4462 (comment)

@MilosPaunovic MilosPaunovic added area/docs Issues related to documentation, plugin examples, blueprints, and guides kind/external Pull requests raised by community contributors labels Apr 2, 2026
@github-project-automation github-project-automation bot moved this to To review in Pull Requests Apr 3, 2026
@MartinRst
Copy link
Copy Markdown
Member

cc @Piyush-r-bhaskar ok for you to merge this one?

Copy link
Copy Markdown
Contributor

@elevatebart elevatebart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us check first if it actually works. I believe it does not

Comment on lines +4 to +5
import fs from "fs"
import path from "path"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this will work on cloudflare.

@MilosPaunovic MilosPaunovic moved this from To review to On hold in Pull Requests Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Issues related to documentation, plugin examples, blueprints, and guides kind/external Pull requests raised by community contributors

Projects

Status: On hold

Development

Successfully merging this pull request may close these issues.

Implement <lastmod> tag in XML Sitemap

4 participants