Hreflang and alternate tags for multilingual webshops
Guide to creating hreflang alternate tags for products in Shoporama stores running in multiple languages.
If you have an online store in multiple languages, you should use hreflang tags to tell Google which language versions of a page belong together. This helps search engines display the correct language version to users in different countries.
What is hreflang?
Hreflang is an HTML attribute that is placed in the <head> section of the page. It tells Google that a page is available in multiple languages and links to the other language versions.
<link rel="alternate" hreflang="en" href="https://dinshop.dk/mit-produkt" /> <link rel="alternate" hreflang="en" href="https://dinshop.dk/en/my-product" />
Add hreflang in your theme
Shoporama does not automatically generate hreflang tags - you need to add them yourself in your theme's header template. Add the following in the <head> section of your global template:
<{if $product}> <link rel="alternate" hreflang="en" href="<{$webshop->getUrl(1)}><{$product->getUrl()}>" />
<link rel="alternate" hreflang="en" href="<{$webshop->getUrl(1)}>/en<{$product->getUrl()}>" /> <{/if}>
Customize the language codes and URL structure to the languages you have enabled on your online store. Shoporama uses the language code as a prefix in the URL (e.g. /en/, /de/, /sv/).
Stores on different domains
If you have separate webshops for different countries (e.g. dinshop.dk and dinshop.no), you can link them together with hreflang tags that point across the domains:
<link rel="alternate" hreflang="da" href="https://dinshop.dk<{$product->getUrl()}>" /> <link rel="alternate" hreflang="no" href="https://dinshop.no<{$product->getUrl()}>" /> <link rel="alternate" hreflang="x-default" href="https://dinshop.dk<{$product->getUrl()}>" />
Tip
Always add an x-default tag pointing to your primary language version. This tells Google which version to show to users where no specific language version fits.
Translate product texts
For hreflang to make sense, your products need to have translated titles and descriptions. Change language at the top of the administration to edit products in that language.
Do you need help? Contact us at support@shoporama.dk.
Related articles
Add multiple products to the basket at a time
Guide to implementing an 'add more to cart' feature, for example on landing pages or wholesale pages.
Update the cost price of multiple products at once
Guide to mass edit the cost price (purchase price) of multiple products in the Shoporama admin.
Age verification on products
Guide to setting up age verification on products in Shoporama. Set the age requirement to 16 or 18 years and let the payment gateway handle the...