Typo3: Including the Home Page (Site Root) in Navigation

Submitted by Hannes Schmidt on Wed, 01/05/2005 - 14:30.

In modern web design, it is considered good practice to have a "Back To Home" link on every page so that users can easily return to the root of the site, i.e. the home page. Because of that I wanted a Home button on every page of my client's Typo3-based website. Although this seems like a very simple thing to do, it turned out to be quite a challenge in Typo3, especially when trying to avoid duplicate content penalties induced by major search engines.

In Typo3 every site starts with a root page, also known as site root or home page. This site root is assigned the / URL path which means that its URL is http://www.domain.com/. Most Typo3 websites use one or more HMENU objects in the root template for navigation. It's one of Typo3's idiosyncrasies that the site root cannot be part of any HMENU object. The reason is simple. The entry level for menus (entryLevel property of HMENU) defaults to 0, which stands for the sub pages of the site root. Because negative entryLevel values are used to address pages from the end of the rootline, there is no way to address the site root such that it becomes part of the menu. When I realized that, I thought of two possible solutions

No solution

The site uses CSS styled content and automaketemplate, so why not simply putting the home link into the HTML template? If it's part of the template, it will be included on every page automatically. For many people this might seem the easiest solution but for many reasons it isn't. Typo3's HMENU and its subclasses offers lots of convenient functionality that I wouldn't want to duplicate in my static HTML template. For example, highlighting the currently active menu item is a nice visual effect that is implemented in TMENU/GMENU and that I would like to have for the home link as well. Also, it's more consistent to use the same visual style for the home link as for all other navigation links. In that respect, it makes way more sense to integrate the home link into the navigation menu.

A solution

Typo3 has a feature called shortcut. A shortcut is a page that has no content of its own and that forwards the request internally to another page. Couldn't we make the root page a shortcut to the first sub page of the root page as shown in the following screenshot?

Yes we could and it works surprisingly well. When a user requests http://www.domain.com/, Typo3 looks at the site root and sees that it is a shortcut to another page. Typo3 then loads and returns that page instead of the root page. In the above screenshot, the site root is called Home and has a shortcut symbol next to its icon. The first page below the site root is also called Home. This second Home is the page that the first Home redirects to. In the current version of Typo3 (3.7.0) the redirect happens internally on the server. It is not a 301 or 302 browser redirect although Typo3's online help feature might suggest otherwise. Because the second Home page is the first sub page of the site root, it will be the first item in the site's top-level navigation menu. Splendid!

But wait, there's a problem! Read this article!

( categories: Typo3 | Webmaster )
Submitted by Anonymous on Thu, 07/19/2007 - 03:40.

The easiest way is to leave Home [UID]1 as normal page and create Home as shortcut in level1. The are no differences on URL because URL of HOME in menu will be always /

Markus

Submitted by Hannes Schmidt on Tue, 01/24/2006 - 17:12.

It's this one. Thanks for pointing it out, Darren.

-- Hannes

Submitted by Anonymous on Tue, 01/24/2006 - 11:45.

Hi!

I am trying to do EXACTLY what you describe in the above article, but at the end you said there is a problem, and recommended we "read this article"... I am not sure if that was supposed to be a link, or I am just not that bright :) but I would LOVE to read the article... or get any info on what the problem is!

Any help would be greatly appreciated!

Regards,
Darren.