Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...

AspDotNetStorefront
DotFeed

Is it possible to easily add canonical tags for all pages on website in _Layout.cshtml

I added the following tag to _Layout.cshtml file of my staging site:

<link rel="canonical" href="@Request.Url.AbsoluteUri">

For the most part it does return a valid link for every page on the website, but the links look nothing like the links that are normally displayed when navigating the page. For exampl:

This:
https://www.aspdotnetstorefront.riflegear.com/p-5570-blue-force-gear-helium-whisper-admin-pouch.aspx

Returns as this:
https://www.aspdotnetstorefront.riflegear.com/p-5570.aspx?searchEngineName=blue-force-gear-helium-whisper-admin-pouch

Is there a way to have it return the URL as displayed to the user? Would this even be detrimental to SEO as far as how the Canonical tag is used by search engines/crawlers? 

Has anybody ever solved this problem for all pages on an ASPDNSF 10.x website? Moz Pro is currently reporting over 5.5K MetaData issues of "Missing Canonical Tag" on my website and I would like to clear those out. Any ideas?

Thanks,
David
asked Feb 26 in MultiStore by shark92651 (145 points)

1 Answer

+1 vote
Yes it is possible to have add canonical tags as your example code shows.

If you want to have the same canonical url be the the same as what the user and navagation shows then try the code below:

<link rel="canonical" href="http://@Request.Url.Host@CommonLogic.GetThisPageName(true)" />

As for would it be detrimental to have the canonical tag is somewhat subjective. Since canonical is meant to be way try and state two pages are the same content wise to search engines. That way search engines don't ding you ranking for duplicate content. I do know Moz likes to suggest this tag for every page no matter what so that is why you see so many pages reporting in Moz.
answered Feb 28 by mmcgeachy (4,605 points)
...