Archived blog with a focus on DotNetNuke news, tips and tricks, DNN SEO, and insights and opinions about the DNN community at large.

First time here? You may want to check out the blog archive, subscribe to the RSS feed, sign up for free email updates, or follow me on Twitter. Thanks for visiting!

Using the Canonical Link Tag in DNN 

As announced at SMX West last week, Google, Yahoo, and Microsoft have united behind a new standard to fight duplicated content created by multiple Urls calling on one and the same page. The idea is to designate a single “canonical” Url that then gets indexed by search engines. Up until now, 301 redirects were the preferred way to minimize duplicate content through canonicalization. However, redirection is not always practical, so the following new syntax has been agreed upon:

<link rel="canonical" href="http://seablick.com/blog.aspx"/>

According to W3C specifications, the link tag resides in the <head> section of the HTML document and defines the relationship between a document and an external resource.

I won’t go into further details on the inner workings of the canonical link tag, but instead show you how easy it is to take advantage of it in DotNetNuke.

As you can see from the screenshot above, all you need to do is paste the entire link tag into the Page Header Tags field fount under Page Settings > Advanced Settings. There are no modules or other kinds of extensions required. What do you do with module-driven pages though, which are not associated with conventional Page Settings in any way? Well, the responsibility to add support for the canonical link tag goes back to the module developer. Programmatically speaking, it’s not a big effort to dynamically inject header tags as demonstrated by the core framework. Go bug your module vendor now :)-




Comments

Dahlgren Dahlgren says:

Could this be used to eliminate the TabID-part of a URL, like:
www.mydomain.com/Blog/TabId/5/Default.aspx
transformed to
www.mydomain.com/Blog.aspx

Or you need some rewriter like Ifinity URL Master to accomplish that?

Tom Kraak Tom Kraak says:

No, the canonical link tag is not meant in any way for Url rewriting / redirecting.

To eliminate the tabid, set the default Url provider to "HumanFriendly" in web.config or use Url Master for even greater control of DNN Urls.

Will Strohl Will Strohl says:

Very good blog post. I will certainly be employing this. There must be an easier way to manage things like this. I think I will throw this into my upcoming "Managing DotNetNuke Using SQL Server" session. ;)

Tom Kraak Tom Kraak says:

Thanks Will. On larger sites with a great number of pages, the "page settings approach" will certainly be cumbersome. Keep us posted on what you come up with.

Stuart Stuart says:

I just set this up on all my pages over at Hilbertsolutions.com. Still need to work more on the SEO but I am getting there.

Vitaly Kozadayev Vitaly Kozadayev says:

Great post - Tom, you are awesome!

Here is a gift to you :) - a skin object to handle this. No need to bug any developers... :)

http://continure.com/downloads.aspx

Let me know how it works...

Tom Kraak Tom Kraak says:

Thanks Vitaly, much appreciated.

How will this help with dynamically generated pages such as my blog posts though?

Dahlgren Dahlgren says:

I will have to take a look at that for my sites, you have very neat URLs.
Are you using Url Master for this site? And what blog module?

Vitaly Kozadayev Vitaly Kozadayev says:

You enter http://seablick.com and it adds the rest of the url to it.

Check the explanation on my site.

TomKraak TomKraak says:

@ Dahlgren - Yes, Url Master is behind my Urls with custom rewrite rules for the blog.

Blogs is running on Ventrian News Articles.

Vitaly Kozadayev Vitaly Kozadayev says:

I've updated the skinobject to be installable and to take 3 params: href, excludequerystring and exlcudecanonical.

For those who wants it... enjoy :)

Bruce Chapman Bruce Chapman says:

The actual need for the Canonical url header really comes from tracking id's in the querystring of Urls. They want to be able to say 'ignore these bits of querystring, this is the actual url'.

Because of this, you need to be careful on your blog pages because all your blog posts will be reduced back to blog.aspx. This is the problem with using a skin object, because it's indiscriminate : unless you setup different skins for different pages.

Tom Kraak Tom Kraak says:

@ Bruce - That's what I thought at first, but Vitaly is actually grabing the entire Url.

Won't work in all situations, but looks like he just made some enhancements.

Dahlgren Dahlgren says:

@ Tom: How did you manage to transform the usual "/articleType/ArticleView/articleId/140/" in News Articles to just "/blog/140/"?
Is that done using just URL Master or did you change the NA-module as well to make that work?
I really like the simplicity of your blog URLs.

TomKraak TomKraak says:

@ Dahlgren - All done with Url Master (URLM) and no changes to NA.

I'll have a chat with Bruce to see if we can do a blog post on advanced rewriting with URLM.

Roadshow Roadshow says:

I've run into some issues with the cannonical urls implemented this way. Trashed my rankings for a few days and seemed to forward all of my links to an obscure page on my site. I use iFinity URL rewriter, and I wonder if that had any effect, but I don't think it's likely. I've had to pull the tag until I can find a stable solution.

Tom Kraak Tom Kraak says:

@ Roadshow - could you please describe in more detail what you did? Thanks.

Rodney Joyce Rodney Joyce says:

@Stuart: You may want to check your home page setting - I was seeing how you did the main page and yours is showing as:
"href="http://www.hilbertsolutions.com.com/Home.aspx""

Roadshow Roadshow says:

After quite a bit of frustration and head scratching, I think I figured out what my problem with the canonical tag was. It was a simple oversight, but pretty important. When I was copy/pasting the framework for the tag, I missed the closing carot. That cascaded through the rest of the header and made a real mess.

In all of my rush to be up to date with the latest techniques, I forgot to implement one of the most fundamental ... proofing! This is the kind of stupid goof that can eat up day after day of research and debugging. Just as a reminder, before you go chasing windmills like I did, check your code!

Tom Kraak Tom Kraak says:

@ Roadshow - thanks for the update on the lesson learned :)

eric peerless eric peerless says:

Hey Guys,

Will this issue work for duplicate URL's in google?

For example, google is seeing this as 3 different pages, but they are all the same pages.
http://www.since1910.com/engagement/Tacori.aspx
http://www.since1910.com/Engagement/tacori.aspx
http://www.since1910.com/Engagement/Tacori.aspx

If I go to this page, advanced settings and add the tag that you provided pointing to this URL http://www.since1910.com/engagement.Tacori.aspx - will google only index this page?

Thanks-



Tom Kraak Tom Kraak says:

@ Eric - all 3 versions are already indexed?

robbothan robbothan says:

one thing to bear in mind with the canonical tag- it doesnt give you the full value of a 301 redirect, it does loose some of its strength - however it can be a very handy tool for some things!

Rodney Joyce Rodney Joyce says:

A word of advice - if you have a large site check out the Ifinity Canonical Module - it takes an hour or 2 to add it to every page on your site but it's an important move...

Bruce Chapman Bruce Chapman says:

@Rodney thanks for mentioning the Canonical Linker module. You can use the 'use on all pages' if you prefer, or you can add it to each page and tweak the settings to suit the module on the page.

@robbothan : Canonical Links are best used in combination with a 301 redirect strategy for your site. However, Canonical Links can fix some things that are very difficult to fix in DotNetNuke, such as the site.com/ site.com/default.aspx duplicates. Generally it is very difficult to set up a 301 redirect from /default.aspx -> / because of the way IIS works. With a Canonical Link element, it becomes less of an issue.

Similarly, you would want to use Canonical Links where you are tracking clicks from banner ads or similar, and you want to exclude the tracking id from the Url, so they don't get counted as duplicate content.

Eden Eden says:

Hi guys

Thanks for the blog...

I am having a real problem with google.

One of my URLS was:
http://www.namaste.co.il/articles/tabid/122/default.aspx

Now, I changed the tab name to channels. and the url is:
http://www.namaste.co.il/channels/tabid/122/default.aspx

The thing is that google stil shows up the old urls, which of course, still gets there, since it only takes the tabid.

How do I make a 301 redirect to the new tab?? Is the canonical tab an option here?

Take in mind that I have ventrian's NewsArticles Module in there...

Thanx again
Eden

Bruce Chapman Bruce Chapman says:

@eden taking liberties with Tom's blog to advertise, but the Url Master module will help you with this. A Canonical Link won't help with the redirection of your old /articles/tabid/122 links. What you want is a 301 redirect from the articles/tabid/122 to channels/tabid/122. If you install the Url Master module, you'll not only get a 301 redirect from articles/tabid/1222, it will redirect to a new, clean page url of /channels.aspx. All of your News Articles urls will transfer over neatly as well. Just follow the 'iFinity Url Master' banner on this blog to see the module.

You should still consider using Canonical Links, but they won't fix your redirection needs.

David Lucia David Lucia says:

Hi Everybody,

Is it possible to use Page Header Tag to open up a new window?

I am able to link a pull down menu to a .pdf by Linking the URL; however, there is not an option to open as a new page.

Is this possible using the Page Header Tag? If so, could you provide an example to setup? I tried a number of different syntax with no success...

Thank you.

David

Tom Kraak Tom Kraak says:

@ David - the Page Header Tag textbox is not the place to do it.

There should really be a page setting for this, but as you pointed out, there is none. See this blog post for a workaround.

Laxmi Laxmi says:

Hello.

I want to redirect the http://alert-ims.com/ to http://www.alert-ims.com site in dotnet Nuke. Is its possible.

And also what is the portals in Dotnet Nuke.

Thanks
Laxmi Narayan

Tom Kraak Tom Kraak says:

@ Laxmi - there are a number of different ways you can implement a 301 redirect from non-www to www or vice versa. If you are on shared web hosting and have limited control over the web server (IIS), then your best bet is to do this on the DNN level with a module such as Url Master.

If you are on a VPS or dedicated server and have control over the OS and IIS, then you could install isapi_rewrite or similar.

Sebastien L Sebastien L says:

Hi, excellent information you have !

I would like to know what would be the best way to redirect http://mysite.com/dept to http://mysite.com/dept/tabid/44/default.aspx

Thanks in advance !
Sebastien L

Tom Kraak Tom Kraak says:

@ Sebastien - the 2 approaches described above would cover your situation as well. Yours would be a 302 redirect though.

Sebastien L Sebastien L says:

OK thanks !

Laxmi Laxmi says:

Thanks for these great information. I will try it.

Robert Nicholson Robert Nicholson says:

If your doing that type of redirect its best to do a 301 as otherwise your SEO wont be that great - a good module would be Ifinity's URL master.

Tom Kraak Tom Kraak says:

@ Robert - what redirect are you referring to?

Laxmi's non-www to www certainly needs to be a 301, but Sebastien's vanity Url is better served with a 302.

Robert Nicholson Robert Nicholson says:

@Tom
Sebastian's is "http://mysite.com/dept to http://mysite.com/dept/tabid/44/default.aspx" - thats better served by 301 - otherwise your telling the search engine its only temporary (which it isnt) and diluting your page strength between different pages.
I also think he's saying it the wrong way round - it should be he's redirecting the:
/dept/tabid version -> via 301 -> to the /dept version

Tom Kraak Tom Kraak says:

My understanding is that Sebastien is trying to use a shorter Url for marketing purposes, which will never replace the longer DNN Url and is therefore temporary (302.)

Comments are closed

Subscribe to our Feeds Follow on Twitter