Site structure
Version 5.x > Site structure > Base URL and the Home Page View modes: 
User avatar
Member
Member
MedusaTech - 9/6/2010 6:33:22 AM
   
Base URL and the Home Page
Hi Guys

We have published a site with a traditional structure and navigation that includes a Home page. Navigating to the base URL lands you on the Home page as does clicking the Home menu item. However when clicking the Home navigation item we get http://<BaseURL>/home (as we are using extensionless URL’s).

My Clients SEO company have asked me to “remove” the http://<BaseURL>/home URL and just use http://<BaseURL>/ for the Home page as this is optimal for Search Engines (the home page being indexed as http://<BaseURL>/home and http://<BaseURL> currently).

I have had a look around and I have noticed that other sites built on Kentico have achieved this by viewing the source, for example:

<div><ul class="CMSTreeMenuTable" style=""><li class="CMSTreeMenuItem" id="topNav_tid_0_0" style=""><span class="top"></span><a href="/" style="" class="CMSTreeMenuLink" id="topNav_tid_0_0_item" title="Home" >Home</a><span class="bottom"></span></li>…
Whereas ours reads:

<li class="selected"><a href="/Home" >Home</a></li>

I understand that within the site structure “/” refers to the master page however the site in question is actually displaying the Home page directly from the URL and from the Home menu Item.
We are probably missing a trick here but how exactly are they achieving this on http://www.asitisconsulting.com/ ?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 9/6/2010 10:55:05 AM
   
RE:Base URL and the Home Page
Hi,

If you are using CMSTreeMenu webpart for navigation, you can add following method to CMSTreeMenu.ascx.cs code (/CMSWebParts/Navigation/cmstreemenu.ascx.cs):

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.menuElem.LoadDataAutomaticaly = false;
string html = this.menuElem.RenderedHTML.ToString();

this.menuElem.RenderedHTML = html.Replace(CMS.GlobalHelper.UrlHelper.ResolveUrl("~/Home"), "/");
}

The path to Home document will be replaced with "/".

Best regards,
Ivana Tomanickova

User avatar
Member
Member
MedusaTech - 9/6/2010 12:33:53 PM
   
RE:Base URL and the Home Page
Hi Ivana

We are actually using the CMSListMenu but having looked at the structure of both the controls I made the changes and it works a treat!

Thanks for the prompt response, that change is now live and the SEO Company are happy...for now, lets just wait and see whats next!

Once again thanks for the fix

Cheers
Mark