Set pagetitle and metadata in own extensions

To make your TYPO3 project more searchenginefriendly it could be necessary to set pagedata in the extension.

For example if you have an Extension which shows details of an record.

This is possible with the help of the Extension "danp_libs".

Set the Pagetitle:

//Include the necessary class
require_once(t3lib_extMgm::extPath("danp_libs").'class.tx_danplibs_helper.php');

//Instantiate the class and call function
$this->Helper=t3lib_div::makeInstance('tx_danplibs_helper');
$this->Helper->setPageTitle('der neue seitentitel');

Set the page-metadata:

Here it is possible to do two things:

  1. Set the data in your Extension
  2. Insert the Metatags with TypoScript

--> 1.)

        $this->Helper->setMetaTagData('keywords','die meta keywords');
        $this->Helper->setMetaTagData('description','die meta beschreibung');

--> 2.)

With the help of the extension "metatags" and the userfunc in the extension danp_libs:

page.headerData.999<plugin.meta<br>
page.headerData.999.local {
 description.preUserFunc=tx_danplibs_pi1->getMetaData
 description.preUserFunc.field=description

 keywords.preUserFunc=tx_danplibs_pi1->getMetaData
 keywords.preUserFunc.field=keywords

}

blog comments powered by Disqus
Last Tweets (follow)

blogroll