canonical links in asp.net mvc

2.2k Views Asked by At

All of the following lead to the same homepage of my site:

/
/news/
/news/all-time/all
/news/all-time/all/1

the same .cshtml file will also render other variations, e.g (the number on the end is the page number)

/news/month/all/
/news/month/images/3

im setting it in the view using something like : ViewBag.CanonicalLink = "http://www.exmple.com/";

etc..

now im trying to create a canonical link within the cshtml file, but puzzled with how to set it correctly for SEO? any ideas?

1

There are 1 best solutions below

2
On

You should decide on a single canonical URL and then add <link rel="canonical" href="..."> to the head.