Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[SOLVED] Canonical URL


Go to End


2 Posts   2044 Views

Avatar
Eurisko

Community Member, 27 Posts

27 November 2015 at 5:30am

Edited: 27/11/2015 5:33am

Hi

I can't use the $MetaTags(false) tag in my page.ss, so I just use, for example, <meta name="description" content="$MetaDescription">

I use the virtual page for some duplicate content on my site and I need to access where the page is duplicated from so I can do a canonical tag

<link rel="canonical" href="$MetaCanonical"> or
<link rel="canonical" href="$LinkedPage">

Don't work. Is there some way I can get the linked page URL into the template.

Thanks.

Avatar
Eurisko

Community Member, 27 Posts

27 November 2015 at 5:37am

Got it to work with

        <% if $CopyContentFrom.Link %>
            <link rel="canonical" href="$CopyContentFrom.Link" />
        <% end_if %>