Search code examples
yiimeta-tags

How to replace a meta tag in Yii?


I know that I can register a new meta tag in Yii and I know how to do it, but I need to

replace the default tag that I have set, because when I am on a article, I want to insert the

short description of the article in the meta tag;

How can I manage the meta tags?


Solution

  • If you're on the latest version you can give the metatag an id.

    ->registerMetaTag('example', 'description', null, array(), 'mytagid');
    

    Calling registerMetaTag again with the same id will overwrite it.

    http://www.yiiframework.com/doc/api/1.1/CClientScript#registerMetaTag-detail