Post by Carmine opencart » Wed Aug 22, 2018 12:20 am

Multilanguage site, how can I add in the header the link rel=alternate hreflang ?

<link rel="alternate" href="https://website/en/category-english/titleEN.html" hreflang="en-us" />
<link rel="alternate" href="https://website/it/category-italian/titleIT.html" hreflang="it-it" />

the file to modify should be header.tpl in catalog/view/theme/default/template/common

Thank You


Posts

Joined
Wed Aug 22, 2018 12:06 am

Post by straightlight » Thu Aug 23, 2018 5:35 am

What does that explain as a request / problem? More information is needed.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by thekrotek » Thu Aug 23, 2018 6:37 am

You asked the question and answered it in the same post yourself? This is weird.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Active Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Carmine opencart » Thu Aug 23, 2018 4:57 pm

Hello,
I apologize if I explained myself badly.
I would add the link rel=alternate hreflang in the header but I don't know how can obtain the URLs in other languages.


Posts

Joined
Wed Aug 22, 2018 12:06 am

Post by straightlight » Thu Aug 23, 2018 5:43 pm

In catalog/controller/common/header.php file,

find:

Code: Select all

$data['lang'] = $this->language->get('code');
add below:

Code: Select all

$data['lang_code'] = $this->config->get('config_language'); 
Then, in your HTML provided codes, replace the hreflang values with:

Code: Select all

{{ lang_code }}

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 8 guests