cbd*_*per 6 xml sitemap multilingual hreflang
生成多种语言的站点地图:
按照 Google 的指示:
https://support.google.com/webmasters/answer/189077?hl=en
此代码:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://www.example.com</loc>
<lastmod>${formattedDate}</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
</urlset>
Run Code Online (Sandbox Code Playgroud)
结果(在浏览器中呈现):
此代码(带有xhtml:link标签):
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://www.example.com</loc>
<lastmod>${formattedDate}</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
<xhtml:link rel="alternate" hreflang="en-us" href="https://www.example.com"/>
<xhtml:link rel="alternate" hreflang="en-ca" href="https://ca.example.com"/>
<xhtml:link rel="alternate" hreflang="en-gb" href="https://uk.example.com"/>
</url>
</urlset>
Run Code Online (Sandbox Code Playgroud)
结果(在浏览器中呈现):
问题
似乎没有任何错误。但奇怪的是它没有像往常一样在浏览器中呈现 XML“页面”。
来自 Google的 https://www.google.com/gmail/sitemap.xml似乎也具有相同的行为(您可以检查它并看到响应包含一堆xhtml:link标签)。
我做错了什么还是添加这些标签时的正常行为xhtml:link?
| 归档时间: |
|
| 查看次数: |
3253 次 |
| 最近记录: |