2

XML sitemap files are specified at sitemaps.org. The description for urlset > url > lastmod says

The date of last modification of the file. This date should be in W3C Datetime format. This format allows you to omit the time portion, if desired, and use YYYY-MM-DD.

Note that this tag is separate from the If-Modified-Since (304) header the server can return, and search engines may use the information from both sources differently.

I find this confusing. The term "file" is used exclusively to refer to the XML sitemap.xml (or to files that make up the sitemapindex). Why is this part of the url tag then? The value can't possibly be different for two urls in the same XML file. Also, "If-Modified-Since" is a request header and would never be returned by an RFC compliant web server.

In contrast, the description for sitemapindex > sitemap > lastmod is quite clear and makes sense (note the use of the term "file"):

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.

Is this the canonical specification for XML sitemaps? Is there a newer, revised version? Or is there some authoritative clarification, preferably from Google?

  • 1
    Google has said that it doesn't use the lastmod data from XML sitemaps because it finds many webmasters put in default values or guesses. I just omit it since it isn't used. – Stephen Ostermiller Aug 9 '17 at 10:53
  • Do you have a reference for that by any chance? I'm inclined to do the same but I have to argue that to our SEO team. – Peter Aug 9 '17 at 11:51
  • 1
    It's confirmed by Gary(aka methode), who work in Google core search team. And if your SEO team participate in Google official hangout then john also said that many times. :) – Goyllo Aug 9 '17 at 12:02
  • 1
    Google's Gary Illyes: "The lastmod tag is optional in sitmaps and in most of the cases it's ignored by search engines, because webmasters are doing a horrible job keeping it accurate." seroundtable.com/google-lastmod-xml-sitemap-20579.html – Stephen Ostermiller Aug 9 '17 at 12:07
  • The date of last modification of the file... refers to something like example.com/index.html. Even if the URL is example.com/, the default file is assumed. This is not referring to the sitemap, but the resource being referred to in the URL within the sitemap file. – closetnoc Aug 9 '17 at 17:34
3

I just stumbled across Google's Best practices for XML sitemaps & RSS/Atom feeds, which describes lastmod as follows:

The last modification time should be the last time the content of the page changed meaningfully. If a change is meant to be visible in the search results, then the last modification time should be the time of this change.

Interestingly, this document contradicts the specification at sitemaps.org by saying that the maximum uncompressed size for a single file is 10 MB, not 50 MB. What a mess.

  • The best practices are from October 2014. If anyone can point to more up to date information I will happily change the accepted answer. – Peter Aug 10 '17 at 10:09
  • Limits were increased from 10MB to 50MB around 2016, here's a new best practices page at Google and an article from Barry Schwartz. – thomasrutter Aug 22 '18 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.