This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
154 Posts
redback
4 years ago
4
Topic

Hello Sebloders,

i am looking for SEO improvements:

The result page of the Lists & Search Type has no canonicals. With all the parameter in URL there could be a rising indexing of irrelevant sites and duplicate sites in Google.

To solve this, i want to have the canonical based on a menuitem, where i linked the List & Search Type. The canoncial tag should be delivered by every searchresult and pagination of the menüitem.

Is there a simply solution?

By the way: The canonical plugin for the article-view/content-view works good.

Best Chris

Get a VIP membership
572 Posts
_jrmo
4 years ago
1
Level 1

Hi Chris,

You could code something in to your list template directly, or your search form through a position override.

I haven't tested this, but within your list template or your search form position override, you could have this:

<?php
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive()->link;
$url = JRoute::_($menu);
$canonical = '<link rel="canonical" href="'.$url.'" />
$document = JFactory::getDocument();
$document->addCustomTag($canonical);
?>

That will make the current menu item the canonical URL of the search results

Let me know if that works,

_jrmo

154 Posts
redback
4 years ago
0
Level 2

Hello _jrmo,

thanks for you answer. I just tried, but coudn't get it work. I used the beforeRender plugin.

Here a code correction:

$app = JFactory::getApplication();

$menu = $app->getMenu()->getActive()->link;

$url = JRoute::_($menu);

$canonical = '<link rel="canonical" href="'.$url.'" />';

$document = JFactory::getDocument();

$document->addCustomTag($canonical);

I coming when it works

154 Posts
redback
4 years ago
1
Level 1

Got a solution for this problem.... Code in the down under.

https://hamberger.marketing/artikel/seblod-seo-in-list-and-search-types

38 Posts
yoyoxp
1 year ago
0
Level 2

Nice solution, thanks for sharing Redback!

Get a VIP membership