TYPO3 SEO friendly page title

From snippet wiki
Jump to navigation Jump to search

Sometimes your current page just displays its title and preceeded by the website name. That might be not enough to find that page in a whole tree of similar ones. I needed to have a page title starting with the current leave back to nearly the root name:

TypoScript constant:

titlepfx = My website name:
titlesep = «

TypoScript setup:

config.noPageTitle = 2

lib.pagetitle = COA
lib.pagetitle {
  stdWrap.noTrimWrap = |<title>{$titlepfx} |</title>|
  10 = HMENU
  10 {
    special = rootline
    special.range = 1|-1
    special.reverseOrder = 1
    includeNotInMenu = 1
    1 = TMENU
    1.NO = 1
    1.NO.doNotLinkIt = 1
    1.NO.allWrap = | {$titlesep} ||*|| {$titlesep} ||*||
    1.NO.stdWrap2.noTrimWrap = | | |
  }
}

page {
  headerData {
     2 < lib.pagetitle
  }
}