Menu

Post image 1
Post image 2
1 / 2
0

Reading sitemap lastmod from MDX frontmatter in Astro

DEV Community: astro·Aulvem·3 days ago
#kDcZghX9
Reading 0:00
15s threshold

@astrojs/sitemap won't read updatedDate from MDX frontmatter on its own. Left at the defaults, every entry in the generated sitemap.xml ends up with lastmod set to the build time. Search engines and AI search treat that as "everything was updated, all the time", which is worse than not setting a freshness signal at all. This post walks through the minimum implementation: walk MDX inside astro.config.mjs , build a path-to-date map, and feed it into serialize on @astrojs/sitemap . Paginated noindex pages get filtered out in the same pass. What we're building Three steps inside astro.config.mjs : Build a lastmod map : read every blog MDX with fs.readdir , extract updatedDate ??…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More