[solved] Canonical url for news don't work

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Samuele
Forum Members
Forum Members
Posts: 21
Joined: Wed Feb 04, 2009 8:15 am

[solved] Canonical url for news don't work

Post by Samuele »

Hi,
I updated cms from 1.5.2 to 1.5.3 

I add in all my template this

Code: Select all

<link rel="canonical" href="{if isset($canonical)}{$canonical}{else}{$content_obj->GetURL()}{/if}" />
for canonical url.

But don't work for news page. The canonocal url for this page is always the root site

Example:

Code: Select all

http://localhost:85/dm2/news/2/21/News-numero-1.html
canonical url returned is

Code: Select all

<link rel="canonical" href="http://localhost:85/dm2/" />
Last edited by Samuele on Thu Mar 05, 2009 7:27 am, edited 1 time in total.
_________________________________________________
Samuele
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Canonical url for news don't work

Post by RonnyK »

Samuele,

2 additional things are required to get it working....

First, the detail-template of News, should start with...
{* set a canonical variable that can be used in the head section if process_whole_template is false in the config.php *}
{if isset($entry->canonical)}
  {assign var='canonical' value=$entry->canonical}
{/if}
which is included in the new default detail-templates, and you will see it when creating a new detail-template.

Second, the process_whole_template parameter in the config.php should be set to FALSE.
$config['process_whole_template'] = false;
Then it should work....

Ronny
User avatar
Samuele
Forum Members
Forum Members
Posts: 21
Joined: Wed Feb 04, 2009 8:15 am

Re: Canonical url for news don't work

Post by Samuele »

Thanks Ronny, now it works.
_________________________________________________
Samuele
Post Reply

Return to “Modules/Add-Ons”