Increasingly I find myself having to add custom meta data in order to validate my ownership of a site. Both Yahoo and Google offer webmaster tools with the option of either adding a static html page or including custom meta tags.
Although its easy enough to quickly upload an html file most of my sites would require explicit tweaks to the .htaccess file to allow the plain html to be served. Without the exception being added the request is caught by the application and a 404 is thrown.
Adding a custom meta tag is therefore the path of least resistance and with a TYPO3 site running TemplaVoila you have two options:
- Edit the underlying TemplaVoila source file (aka File reference)
- Use the headerData object to add the tag using TypoScript
I’d previously gone down the forst route as I couldn’t identify the correct meta object in the TSref but this requires updating the mapping of each Template Object that uses the source file. Now I’ve found the elusive page.headerData object it allows the second, more straightforward solution.
This is the snippet I added to the Setup of my site template to enable me to use Yahoo’s Site Explorer:
page.headerData.666 = TEXT
page.headerData.666.insertData=1
page.headerData.666.wrap = <meta name="y_key" content="|" />
page.headerData.666.value = 94b2aefda6132b35
Adding the google.com verification code would just as simple:
page.headerData.668 = TEXT
page.headerData.668.insertData=1
page.headerData.668.wrap = <meta name="verify-v1" content="|" />
page.headerData.668.value = LNIXg/7hvAc6p3zjr+QmWy+U6q0MFGRaVvCXWn1ctF4=
Remember that this technique can be used to add any additional head content you desire.


1 response so far ↓
1 Sadler // Sep 4, 2008 at 11:12 am
Cheers - just the snippet I needed.
Leave a Comment