P
P
Pavel2020-02-06 22:23:28
Joomla
Pavel, 2020-02-06 22:23:28

How to implement rel="canonical" on com_tags component pages?

I implement rel="canonical" on the site
The question arose how to get a link to the page in the component com_tags
\components\com_tags\views\tag\tmpl\default.php

In the categories of materials I did this

// ------------ Start Canonical-Mod
$menu = JFactory::getApplication()->getMenu();
if($menu->getActive()!= $menu->getDefault()) :
$docpagenr = '';
JFactory::getDocument()->addHeadLink('https://' . $_SERVER['SERVER_NAME'] . JRoute::_(ContentHelperRoute::getCategoryRoute($this->category->id)). $docpagenr, 'canonical', 'rel', '');
endif;
// ------------ End Canonical-Mod

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question