Rosina\’s Typo3 Tips

A Journey in using Typo3

Setting the Title tag

Posted by Rosina Bignall on October 5, 2006

Typo3 automatically creates the <title> tag containing the sitename: page title.

But, I wanted to include the subtitle in the tag so that I can have a longer <title> that is descriptive and keyword rich. So, the page <title> tag should go something like this:

<title> Site name: Page title – Page Subtitle </title>

To accomplish this, add the following to your template:

#Title tag extras:
config.noPageTitle = 2
page.headerData.20 = TEXT
page.headerData.20.value = my Site Name
page.headerData.20.wrap = <title>|:
page.headerData.30 = TEXT
page.headerData.30.field = title
page.headerData.40 = TEXT
page.headerData.40.field = subtitle
page.headerData.40.wrap = – |
page.headerData.40.if.isTrue.field = subtitle
page.headerData.50 = TEXT
page.headerData.50.value = </title>

config.noPageTitle = 2 suppresses Typo3’s <title> tag creation (setting it equal to 1 tells Typo3 to create the title with only the site name, resulting in two <title> tags which I understand does terrible things to you in the search engine rankings.)

The rest of the lines describe the construction of the <title> tag. So, if your page title is “My Page Title” and the subtitle is “My Page Subtitle”, the <title> tag will look like this:

<title>my Site Name: My Page Title – My Page Subtitle</title>

and in the browser you will see

my Site Name: My Page Title – My Page Subtitle

Check out Learner’s Village product The Secrets of Influence, to see this in action!

Future work: I’d like to find out how to get the site name automatically (something like, “page.HeaderData.20.field = sitename”) so that it is not hard coded in the template (then I only have to change the site name in one place and I can use the same template for multiple websites)

6 Responses to “Setting the Title tag”

  1. Small improovement:

    #Title tag extras:
    config.noPageTitle = 2
    page.headerData.5 = TEXT
    page.headerData.5.value = My Site
    page.headerData.5.noTrimWrap =||: |
    page.headerData.10 = TEXT
    page.headerData.10.field = title
    page.headerData.15 = TEXT
    page.headerData.15.field = subtitle
    page.headerData.15.noTrimWrap =| – | |
    page.headerData.15.if.isTrue.field = subtitle
    page.headerData.20 = TEXT
    page.headerData.20.value =

  2. Michael said

    The TS that you need to access the “Website Title” field of the template is:
    page.headerData.5.value

  3. Michael said

    Ah, that seems to have been mangled by WordPress. Let’s try this:

    page.headerData.150.value

  4. Michael said

    Ok – this comments feature is not suitable for leaving HTML suggestions as it keeps removing angle brackets!

    Rosina, email me for the snippet.

  5. Matt said

    Thanks for this clear and concise snippet. Would be nice to be able to get the website title from the field instead of hard coding it here. Looked for 15 mins for a solution — is this so hard 😉

  6. I’m using Site Title value from tamplate record like this:

    page.headerData.20.value < sitetitle
    page.headerData.20.wrap = : |

    It works well and it is not hardcoded in template definition 😉

Leave a comment