RSS 2.0
RSS 0.91
ATOM 0.3
January 18, 2007

Changing the Default Header for Content Elements

Category: Ron Hall

By: Ron Hall

Setting the constant that controls the header level for the default layout.

Early in my TYPO3 work I continually found myself having to change the header of content elements to something other than the default of H1. Normally, I would leave alone the first headline on a page (which usually echoed the page title) but other headlines I would usually set to something else (often an H3). I did this not only because multiple H1's would overpower the page visually but also I wanted a more sensible semantic layout.

Bottom line, I found myself continually changing the header type. I also began to be concerned with the ramifications when I turned over the day to day editing of the site to someone less in tune with the proper use of header levels. I imagined an epidemic of H1 headers.

However, after a little research I found the TYPO3 constant that controls what type of header is used by default for content elements.

In the constants field (not setup) of your typoscript template add:

content.defaultHeaderType = 3

From that point in the page tree each header assigned a layout of "default" will be an H3. Change the "3" to another number and you will have the corresponding header level (i.e. change it to a "2" and you will have a default of H2).


comment #1
Gravatar: Sebastian Kurfuerst Sebastian Kurfuerst January 18, 2007 10:20
Very nice trick :-)
I really enjoy your blog series!


comment #2
Gravatar: Fabian Fabian January 18, 2007 21:34
Nice tip, thanks!

comment #3
Gravatar: Michael Cannon Michael Cannon January 18, 2007 22:44
From working with a good amount of clients dealing in SEO, setting "content.defaultHeaderType = 2" is my recommendation. The reasoning behind this is that more than one H1 per page will throw off your search rankings.

Sorry, comments are closed for this post.