question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lastmod for sitemap index entries?

See original GitHub issue

Is it possible to add a lastmod property for entries in a sitemap index?

I currently have code like this to create the sitemap index XML string:

// create the xml to be used for the sitemap-index by giving it an array of urls
const sitemapIndexXML = pd.xml(sitemap.buildSitemapIndex({
  urls: fileNameArray.map((fileName) => `${baseUrl}/${fileName}`)
}));

Is there any way get the generated sitemap index to have a <lastmod> element, similar to how the module allows you to pass a lastmodISO property when creating a sitemap?

Ideally it would produce XML like this:

<sitemap>
  <loc>http://example.com/sitemap-us.xml</loc>
  <lastmod>2016-11-22T18:06:38.207Z</lastmod>
</sitemap>
<sitemap>
  <loc>http://example.com/sitemap-ca.xml</loc>
  <lastmod>2016-11-22T18:06:38.207Z</lastmod>
</sitemap>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
jyotmancommented, Mar 21, 2017

@ekalinin can we introduce this feature?

According to sitemaps protocal there’s an optional lastmod attribute which can be given to each sitemap in a sitemap index.

lastmod

Identifies the time that the corresponding Sitemap file was modified. It does not correspond to the time that any of the pages listed in that Sitemap were changed. The value for the lastmod tag should be in W3C Datetime format. By providing the last modification timestamp, you enable search engine crawlers to retrieve only a subset of the Sitemaps in the index i.e. a crawler may only retrieve Sitemaps that were modified since a certain date. This incremental Sitemap fetching mechanism allows for the rapid discovery of new URLs on very large sites.

1reaction
derduhercommented, Jul 10, 2019

This is supported now, sitemap.buildSitemapIndex({urls:[{url: ‘http…’, lastmod: ‘2016-11-22T18:06:38.207Z’}]})

Read more comments on GitHub >

github_iconTop Results From Across the Web

Protocol - sitemaps.org
Sitemap Index XML Tag Definitions ; <lastmod>, optional. Identifies the time that the corresponding Sitemap file was modified. It does not ...
Read more >
XML Sitemap: the ultimate reference guide | ContentKing
An XML Sitemap is a special document which lists all pages on a website to provide search engines with an overview of all...
Read more >
Manage Large Or Multiple Sitemaps | Google Search Central
You can submit multiple sitemaps at once with a sitemaps index file. Learn how to manage large sitemaps or sitemaps for multiple sites....
Read more >
When should I update lastmod value in the sitemap?
(For my wordpress site with over 10,000 indexed URLs, I am upating lastmod only for major updates and not for minor ones like...
Read more >
XML Sitemap: Ultimate Guideline for SEOs
lastmod shows when the URL was last changed. In our example, it was on January 1st, 2005. With this entry, the search engine...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found