Tag to insert a page's URL in its own HTML script

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
ianlee
New Member
New Member
Posts: 2
Joined: Wed Apr 04, 2012 5:00 pm

Tag to insert a page's URL in its own HTML script

Post by ianlee »

I want to add a canonical statement to a template to prevent Google indexing the same page with different URL's. Something like:
<link rel="canonical" href="http://www.safari-club.co.uk/botswana-safaris" />
Unfortunately CMS does not seem to provide a tag for a page alias or preferably its full url so that a generic statement can be added to a template rather than having to add and edit the above to every single page. Any ideas?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Tag to insert a page's URL in its own HTML script

Post by Dr.CSS »

You haven't seen this in the top of any of the default templates?...

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

You may want to look in extensions > tags to see ones that can be used like {title}, {sitename}, etc., there is also {$page_alias}...
ianlee
New Member
New Member
Posts: 2
Joined: Wed Apr 04, 2012 5:00 pm

Re: Tag to insert a page's URL in its own HTML script

Post by ianlee »

Brilliant, thanks, it works. I spent all afternoon looking through the CMS. No not on the top of any of the templates. Can't see tags like {$page_alias} anywhere either.
Post Reply

Return to “CMSMS Core”