Keyword

Alternate relation / hreflang not working for categories

More
7 years 8 months ago #156755 by Beni
Hi,
...i'm trying to optimize hreflang tags for a customers site. And maybe i found a bug.

When using a k2 category as menu type, an alternate relation code is added to the site, but just for the main language not in other languages.
(But it seems to work with k2 single articles as menu type....)

Working.:
<base href="www.mydomain.com/">
<link href="www.mydomain.com/fr/" rel="alternate" hreflang="fr-FR">

Not-Working:
<base href="www.mydomain.com/fr/">
MIssing: <link href="www.mydomain.com/" rel="alternate" hreflang="en-EN">


Can anyone confirm this or am i wrong? Does anyone know a quikfix?!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 8 months ago #156766 by Krikor Boghossian
Replied by Krikor Boghossian on topic Alternate relation / hreflang not working for categories
Hello,

These codes are being added by Joomla!
You can add the missing codes using Joomla!'s API
docs.joomla.org/JDocument/setMetaData

Furthermore make sure to use overrides instead of editing core files (the category.php)
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #156769 by Beni
The link to the joomla documentation is great! Thanks! :)

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 8 months ago #156771 by Krikor Boghossian
Replied by Krikor Boghossian on topic Alternate relation / hreflang not working for categories
You 're welcome Beni :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago #157802 by Beni
Hi Krikor,
....i'm sorry, but i'm no "coder"... could you give me an example how the code should look like in my case? I can get it working with metatitle oder description...but not for a hreflang...

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #157813 by Krikor Boghossian
Replied by Krikor Boghossian on topic Alternate relation / hreflang not working for categories
You can use a similar function.
$doc = JFactory::getDocument();
$doc->addCustomTag('<link href="www.mydomain.com/fr/" rel="alternate" hreflang="fr-FR">'); 

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum