Typo3: How to insert the Page Title dynamically into the Description meta tag
-
07-02-2021 - |
Question
Using the Introduction Package 4.5 (Not templa voila)
The page.meta template sets the meta tag 'description' in Setup:
page.meta {
description = {$plugin.meta.description}
}
. . . and the description string value is defined in the root template Constant:
plugin.meta {
description = description string goes here
}
But now how do I dynamically include each Page Title in the Description meta tag? Something like
description = {plugin.meta.description}{pageTitle.value} ?
Any clues will be appreciated.
Solution
To put this in a single line you could use .dataWrap on description like this:
page.meta.description.dataWrap = {$plugin.meta.description} - {field:title}
OTHER TIPS
You can use any stdWrap function on description
, I would use a COA to combine those values:
page.meta.description.cObject = COA
page.meta.description.cObject {
10 = TEXT
10.value = {$plugin.meta.description}
20 = TEXT
20.data = field:title
}
You can find more information here: http://wiki.typo3.org/TSref/META
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow