hide page alias from default page url in menus
Posted: Sat Mar 24, 2007 4:28 am
one of the 'annoyances' in cmsms is that when you use 'pretty urls', the 'home' or 'default' page's alias is included in the generated menus. instead of using just "/" or "http://www.yourdomain.com/" for the link of the site's default page, the menus have "http://www.yourdomain.com/home/" (or similar)... with two urls (such as http://www.yourdomain.com/ and http://www.yourdomain.com/home/) both pointing to the same page, search engines can get a little kornfused, and who knows.. the duplicate content on multiple 'pages' may even hurt a little....
to make your menus output a different url for your 'home' page .. replace:
$node->url
in your menu template(s) with:
{if $node->alias !="home"}{$node->url}{else}/cms/{/if}
where 'home' (in red, above) is the alias of the page you want to output a different url for; and '/cms/' (in blue, above) is the url you want inserted instead. (note there is likely more than one instance of $node->url to change)
this example would be if your cmsms installation was in the subdirectory /cms/ (i.e. http://www.yourdomain.com/cms/)
to just point to the domain root, use just / or type it out http://www.yourdomain.com/
this doesn't address cms_selflink or sitemap tags or the output of something like the google sitemap generator.... only the menu generation.
to make your menus output a different url for your 'home' page .. replace:
$node->url
in your menu template(s) with:
{if $node->alias !="home"}{$node->url}{else}/cms/{/if}
where 'home' (in red, above) is the alias of the page you want to output a different url for; and '/cms/' (in blue, above) is the url you want inserted instead. (note there is likely more than one instance of $node->url to change)
this example would be if your cmsms installation was in the subdirectory /cms/ (i.e. http://www.yourdomain.com/cms/)
to just point to the domain root, use just / or type it out http://www.yourdomain.com/
this doesn't address cms_selflink or sitemap tags or the output of something like the google sitemap generator.... only the menu generation.