evgeniweb Posted January 23, 2019 Share Posted January 23, 2019 Hello guys, I have Prestashop 1.7.4.2 with Classic theme. The site has two languages, so I need to place in the head: <link rel="alternate" hreflang="x-default" href="https://www.example.com/en/collection/dresses" /> I have found that the head is managed through the head.tpl file, and the hreflang tags are called with: {block name='head_hreflang'} {foreach from=$urls.alternative_langs item=pageUrl key=code} <link rel="alternate" href="{$pageUrl}" hreflang="{$code}"> {/foreach} {/block} My guess is that I will need to call the En version of the current page and use the same template to put the default tag. How can I call the English version of the current page instead of looping through all available languages with $urls.alternative_langs *Not a dev, just can read and cope with some code, so will appreciate any advice. Thanks in advance. Link to comment Share on other sites More sharing options...
tdsoft Posted January 24, 2019 Share Posted January 24, 2019 What is "English version of the current page"? Prestashop Only use ONE *.tpl file for all languages? Link to comment Share on other sites More sharing options...
evgeniweb Posted January 26, 2019 Author Share Posted January 26, 2019 Ok, let me ask this way... how can I put in the head of every page this tag: <link rel="alternate" hreflang="x-default" href="http://www.example.com/en/thispage" /> Link to comment Share on other sites More sharing options...
Dandry Posted November 12, 2020 Share Posted November 12, 2020 Knowing that my default language is en, I handled it in the following way in head.tpl: {block name='head_hreflang'} <link rel="alternate" href="{$urls.alternative_langs['en']}" hreflang="x-default"> {foreach from=$urls.alternative_langs item=pageUrl key=code} <link rel="alternate" href="{$pageUrl}" hreflang="{$code}"> {/foreach} {/block} 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now