ikeikeikeike / go-sitemap-generator

go-sitemap-generator is the easiest way to generate Sitemaps in Go
https://github.com/ikeikeikeike/go-sitemap-generator
MIT License
220 stars 65 forks source link

Alternate links #35

Open omares opened 4 years ago

omares commented 4 years ago

Hey @ikeikeikeike,

does your library support localized links in the sitemap as documented by google (see sitemap toggle)?

I tried to add <xhtml:link /> entries but did not succeed.

Desired of an url entry would be:

  <url>
    <loc>http://www.example.com/english/page.html</loc>
    <xhtml:link 
               rel="alternate"
               hreflang="de"
               href="http://www.example.com/deutsch/page.html"/>
    <xhtml:link 
               rel="alternate"
               hreflang="de-ch"
               href="http://www.example.com/schweiz-deutsch/page.html"/>
    <xhtml:link 
               rel="alternate"
               hreflang="en"
               href="http://www.example.com/english/page.html"/>
  </url>

Cheers