Mobile app version of vmapp.org
Login or Join
Moriarity557

: Should I put my locale query param in sitemap url? I am currently generating my sitemap for my website, listing all pages generated by users (with pictures and datas). Those pages are publicly

@Moriarity557

Posted in: #Language #Seo #Sitemap

I am currently generating my sitemap for my website, listing all pages generated by users (with pictures and datas). Those pages are publicly accessibles, and have content internationalized in french and english, depending on the user's accepted language. It can be forced using the _locale query parameter.

should I use the following sitemap (including the query param in the loc) ? Or should I remove the query param from the loc, and keep it only in alternate ? (i removed other fields like lastmod, changefreq and priority for brevity)

<url>
<loc>https://mywebsite.com/users/XXX/posts/YYY?_lang=en_US</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://mywebsite.com/users/XXX/posts/YYY?_lang=en_US"/>
<xhtml:link rel="alternate" hreflang="fr" href="https://mywebsite.com/users/XXX/posts/YYY?_lang=fr_FR"/>
</url>


I believe that putting it in the loc would tell google that the canonical url is indeed with the locale parameter set to en_US. Would that pose a problem in term of search results or appearance ? (This link is displayed in various places without this query parameter)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Moriarity557

1 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

You are correct that adding the locale parameter to the sitemap would let Google know that is the preferred canonical version of the URL. John Mueller who works at Google on sitemaps gives that as one of their uses in the Sitemap Paradox question.

Your use of including the parameter and setting alternate hreflangs in sitemap looks perfect. I wouldn't normally recommend using parameters for locale (see How should I structure my URLs for both SEO and localization?), but if you have done so, then you have to use the sitemap like you propose.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme