Page 1 of 1

[solved] Canonical url for news don't work

Posted: Wed Mar 04, 2009 5:31 pm
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/" />

Re: Canonical url for news don't work

Posted: Wed Mar 04, 2009 7:36 pm
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

Re: Canonical url for news don't work

Posted: Thu Mar 05, 2009 7:26 am
by Samuele
Thanks Ronny, now it works.