Page 1 of 1

Canonical Link for CG Calendar Event detail pages

Posted: Thu Mar 18, 2010 5:43 am
by JohnnyB
To generate an event's canonical link add this to the top of your Event Display (Detail) template:

Code: Select all

{capture name='cann' assign='canonical'}{$gCms->config.root_url}/{$smarty.get.page}{/capture}
{assign var='canonical' value=$canonical}
Be sure to include the canonical link in your template:

Code: Select all

{if isset($canonical)}<link rel="canonical" href="{$canonical}" />{elseif isset($content_obj)}<link rel="canonical" href="{$content_obj->GetURL()}" />{/if}

Re: Canonical Link for CG Calendar Event detail pages

Posted: Fri Dec 30, 2011 8:02 pm
by carasmo
Thanks for this! I can get the last part of the url, but the root url (to the site) does not show up. What's the update for this for v. 1.10 and up?

Thanks again!

Re: Canonical Link for CG Calendar Event detail pages

Posted: Fri Dec 30, 2011 8:05 pm
by calguy1000
{root_url}

Re: Canonical Link for CG Calendar Event detail pages

Posted: Fri Dec 30, 2011 8:10 pm
by carasmo
Yeah, I'm having a flash of stupid right now ;-)

Code: Select all

{* set a canonical variable that can be used in the head section if process_whole_template is false in the config.php *}
{capture name='cann' assign='canonical'}
{root_url}/{$smarty.get.page}{/capture}
{assign var='canonical' value=$canonical}