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
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)
OR
### CUSTOM PAGE TITLE
# suppress default title tag
config.noPageTitle = 2
# declare a page header text object
page.headerData.10 = TEXT
# use page subtitle field first; otherwise use page title field
page.headerData.10.field = subtitle // title
# wrap the field with the following
page.headerData.10.wrap = <title>Your Sitenam,e: |</title>



Recent Comments