All things Shopify and commerce
We have implemented an automatic language detection in our store, which redirects the user to his preferred language (browser language) when he arrives at the store.
The problem is, that the Googlebot has English set as language, which causes that all pages get indexed only in English.
What's the best practice here?
Hi 👋,
to ensure Googlebot indexes all language versions of your site correctly, you should avoid redirects for bots, use hreflang tags, create language-specific sitemaps, use canonical tags, and have language-specific URLs.
Detect if the user-agent is a search engine bot and serve the default or requested language without redirecting. Implement hreflang tags to specify language versions of your pages:
<link rel="alternate" href="https://www.example.com/en" hreflang="en">
<link rel="alternate" href="https://www.example.com/fr" hreflang="fr">
Submit separate sitemaps for each language in Google Search Console. Use canonical tags to indicate the preferred version of a page to prevent duplicate content issues:
<link rel="canonical" href="https://www.example.com/en">
Ensure each language version has a unique URL (e.g., example.com/en, example.com/fr).
Example code for bot detection:
function isSearchEngineBot() {
const bots = ['googlebot', 'bingbot', 'slurp', 'duckduckbot', 'baiduspider', 'yandexbot', 'sogou'];
const userAgent = navigator.userAgent.toLowerCase();
return bots.some(bot => userAgent.includes(bot));
}
if (!isSearchEngineBot()) {
// Perform automatic language redirection
} else {
// Serve the default or requested language version without redirection
}
By following these steps, you can ensure proper indexing of all language versions by search engines while providing a seamless experience for users.
I hope this helps!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025