I just went live with Gold and have a few questions.
The home page has canonical link as "http://216.139.232.185/Default.aspx"
How can I edit change this to "www.domainname.net" ?
It has been like this all along and I don't want to lose my page authority. For example, according to MOZ "Default.aspx" has no authority at all, but the plain version has page authority of 41.
Home Page Canonical
Home Page Canonical
Contractor's Solutions
www. contractors-solutions.net
www. contractors-solutions.net
- ForumsAdmin
- AbleCommerce Moderator
- Posts: 399
- Joined: Wed Mar 13, 2013 7:19 am
Re: Home Page Canonical
Home page is a webpage object that you can edit in Website -> Webpages section. The URL defined there is basically the URL used as canonical URL. Unfortunately home page is a special case. You want / or empty string to be treated as the URL for home page but this will not be allowed as a valid value for URL.
This special case however can be handled easily in code. Open App_Code/PageHelper.cs. You will see code like this somewhere around line 531.
Update the code to something like this
This special case however can be handled easily in code. Open App_Code/PageHelper.cs. You will see code like this somewhere around line 531.
Code: Select all
string objectUrl = storeUri.Scheme + "://" + storeUri.Authority + page.ResolveUrl(catalogObject.NavigateUrl);
Code: Select all
string objectUrl = storeUri.Scheme + "://" + storeUri.Authority;
if(catalogObject.NavigateUrl.ToLowerInvariant().Equals("default.aspx"))
{
objectUrl = objectUrl + page.ResolveUrl("/");
}
else
{
objectUrl = objectUrl + page.ResolveUrl(catalogObject.NavigateUrl);
}
Re: Home Page Canonical
Thanks, but I just tried this and there is no change. The canaonical is still /Default.aspx
Contractor's Solutions
www. contractors-solutions.net
www. contractors-solutions.net
Re: Home Page Canonical
I think there is small problem with code posted by ForumsAdmin.
update this statment to
Code: Select all
if(catalogObject.NavigateUrl.ToLowerInvariant().Equals("default.aspx"))
Code: Select all
if (catalogObject.NavigateUrl.ToLowerInvariant().EndsWith("default.aspx"))
Re: Home Page Canonical
Thanks Mazhar. That worked pretty well, as usual.
Thanks,
Scott Kahle
Thanks,
Scott Kahle
Contractor's Solutions
www. contractors-solutions.net
www. contractors-solutions.net