164 Posts
redback
9 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 Book for SEBLOD
572 Posts
_jrmo
9 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

164 Posts
redback
8 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

164 Posts
redback
8 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

40 Posts
yoyoxp
5 years ago
0
Level 2

Nice solution, thanks for sharing Redback!

Get a Book for SEBLOD