XSD For Sitemap with HREFLANG

后端 未结 3 693
南方客
南方客 2021-01-18 17:31

We are launching a major website with support for 20 languages and tons of regional content (i.e. content that is targeted to a specific country or set of countries). As suc

相关标签:
3条回答
  • 2021-01-18 17:58

    I had the same problem and I found a solution. Download all XSDs to your local drive and create a new XSD file that imports all the namespaces.

    <?xml version="1.0" encoding="utf-8"?>
    <xsd:schema xmlns="http://symfony.com/schema"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                targetNamespace="http://symfony.com/schema"
                elementFormDefault="qualified">
        <!--
            The Sitemap schema does not include the link element that is
            utilized by Google for multi-language Sitemaps. Hence, we need
            to combine the two schemas for automated validation in a dedicated
            XSD.
        -->
        <xsd:import namespace="http://www.sitemaps.org/schemas/sitemap/0.9"
                    schemaLocation="sitemap.xsd"/>
        <xsd:import namespace="http://www.w3.org/1999/xhtml"
                    schemaLocation="xhtml1-strict.xsd"/>
    </xsd:schema>
    
    0 讨论(0)
  • 2021-01-18 18:03

    Sitemap guides with hreflang from google are wrong. The sitemap doesn't validate as the xhtml:link does not exist in namespace.

    Change namespace to the one below and it will validate.

    xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html"
    
    0 讨论(0)
  • 2021-01-18 18:06

    If you change the namespace to xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html" which was suggested by @datahell you will receive a namespace warning from google when trying to validate your sitemap.

    You should use the one that google has in their example. This will cause your links to look like straight text on a webpage which is not very appealing.

    You may or may not want to style your xml.

    Happy Multilingual Sitemapping!

    0 讨论(0)
提交回复
热议问题