Xaver Maierhofer

web log

Monday, 02.01.2012

seo for a21glossary

set <title>-tag and and meta-description for single sites from a21gloassary


checks if a uid for a21glossary is set and gets the information from the database. i normally have the title-tag in page.headerData.5. change it, if you have another id.

code for typoscript:

  1. [globalVar = GP:tx_a21glossary|uid > 0]
  2. page.headerData.5 = TEXT
  3. page.headerData.5 {
  4.   cObject = CONTENT
  5.   cObject {
  6.     table = tx_a21glossary_main
  7.     select.selectFields = short
  8.     select.where = deleted=0 AND hidden=0
  9.     select.andWhere = uid={GP:tx_a21glossary|uid}
  10.     select.andWhere.insertData = 1
  11.     renderObj = TEXT
  12.     renderObj.field = short
  13.   }
  14.   wrap = <title>Sitetitle - Glossar -  |</title>
  15. }
  16. temp.meta = TEXT
  17. temp.meta {
  18.   cObject = CONTENT
  19.   cObject {
  20.     table = tx_a21glossary_main
  21.     select.selectFields = longversion
  22.     select.where = deleted=0 AND hidden=0
  23.     select.andWhere = uid={GPvar:tx_a21glossary|uid}
  24.     select.andWhere.insertData = 1
  25.     renderObj = TEXT
  26.     renderObj.field = longversion
  27.   }
  28. }
  29. page.meta.description < temp.meta
  30. [end]