Changing the Default Header for Content Elements

January 17, 2007

Setting the constants 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).

 
 

Noggin's Notebook

This is my little corner to chronicle my adventures in all things web including CSS, HTML, TYPO3, PHP and whole host of other acronyms.

RSS Feed for Noggin's NotebookRSS Feed for
Noggin's Notebook