大网数据广告活动
网站运营与故障问答

Why is the sitemap validator returning an error for the "lastmod" tag?

· 52CE 我爱测

The sitemap of my company's brand's website seems to be fine when I look at it at first glance. I don't particularly see any errors as such. However, SEMrush, the SEO tool, reports that our sitemap is not in the correct format. S…

问题原文

原帖链接 · Anish Kuriakose · CC BY-SA 3.0

The sitemap of my company's brand's website seems to be fine when I look at it at first glance. I don't particularly see any errors as such. However, SEMrush, the SEO tool, reports that our sitemap is not in the correct format. SEMrush doesn't tell me what's wrong. It just says that the format is incorrect.

So, I submitted the sitemap to this online validator:

https://www.xml-sitemaps.com/index.php?op=validate-xml-sitemap&go=1&sitemapurl=http%3A%2F%2Fwww.photojaanic.com%2Fsitemap.xml&submit=Validate+Sitemap

It says no issues found. But, when I run it through another tool:

http://tools.seochat.com/tools/site-validator/

It returns several errors for the lastmod tags. Here's one of them:

<url><loc>http://www.photojaanic.com/photo-gifts/keychains</loc>
<lastmod>2017-07-24T04:37Z</lastmod><changefreq>yearly</changefreq></url>

Error 1826: Element '{http://www.sitemaps.org/schemas/sitemap/0.9}lastmod': '2017-07-24T04:37Z' is not a valid value of the union type '{http://www.sitemaps.org/schemas/sitemap/0.9}tLastmod'. on line: 5 column: 0

Could this be the reason why the sitemap is wrong? I wonder why the date-time format is wrong.

I also tried another validator. Even that one returns many errors along with the lastmod issue:

http://freetools.webmasterworld.com/tools/site-validator

I'm not so concerned about the other errors as they're related to video or images. That could be rectified. What I'm concerned is about the lastmod tag.

A way to get around the lastmod issue could be to simply exclude the time. However, I'd like to know why there's an error.

已采纳解答

原帖链接 · Patrick Mevzek · CC BY-SA 3.0

Per the schema, tLastMod is the union of xsd:date and xsd:dateTime.

Since you provide hours, you are not in the first case, so your string should conform to the XSD dateTime type, and it does not: you need to specify the part with seconds.

See https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#dateTime-lexical-mapping for the full format.

So, if you try with 2017-07-24T04:37:00Z the validation error on this element should go away.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2018-01-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。