Prismic’s sitemap

Heya! I have an unrelated question or proposal. So, if you check prismic’s sitemap /sitemap-0.xml, you’ll notice that every page has the same lastMod date.

The lastMod date is used by Google’s crawlers to estimate how often they need to visit your content and rerank it. It also sends positive signals to the Google algorithm, som they put you higher on SERP.

However, if you stamp the same date on every page, Google will ignore such param, because it’s a bit manipulative.

I’ve noticed your xml has a similar format as the Astro sitemaps usually do, so assuming you are on Astro you can address this issue with the serialize function from the official sitemap integration.

I’ve tried to figure it out on my own, but couldn’t. My assumption was that I could import the data from Astro:content, but found out I could not.

I am also aware that in integrations you can access the step astro:build:done, which will give you all the generated pages. You can use that to parse each file yourself a second time to find the pubDate and write that information to your sitemap.

But I am not that tech-savvy enough to figure out how to do all of that. So I am just informing you about this issue and if you someday address it, please share the solution. I promise to do the same.


First of all - Good catch.

These dates should probably not be all the same as you say, rather the date that each document changed.

We use Next.js, and more specifically for sitemap generation we use the plugin next-sitemap.

From what I can see in the docs of this plugin, we should be able to use the Custom Transformation Function, to be able to provide our own dates to the lastmod property, which seems to automatically set the date to when the sitemap generates.

However, in the config where this is done we don't have access to the dates of the Prismic documents, so we will probably have to fetch all documents and then find the right one for each sitemap transformation using the path to locate the correct document.

I haven't had the time to test this yet, but there might be something similar you could do with Astro.

I make sure to reply once I know how we will fix this.

Thanks again for catching!

All the best