简体   繁体   中英

addcustomtag doesn't work on joomla 2.5

On one of my pages on website, I noticed some meta properties for Facebook (og properties)

However, I want to change them to another og properties.... but the page is dynamic and for different users shows different content, I wanted to insert metas right in php code which generates the page content.

I tried to use

JFactory::getDocument()->addCustomTag('<meta property="og:type" content="articles" />');

But no reaction... old meta roperty og:type didn't change.

Please, suggest some way to edit page metas or way to use addCustomTag correctly.

Thanks

Joomla doesn't add open graph meta tags by default. You have to find the 3rd party plugin or the template setting that creates them and disable it.

You could place then the new og tags using JDocumentHTML/addCustomTag function. Here is an example:

$doc =& JFactory::getDocument();
$doc->addCustomTag( '
    <meta property="og:title" content="" />
    <meta property="og:type" content="" />
    <meta property="og:url" content="" />
    <meta property="og:site_name" content="" />
    ' );

在此处输入图片说明

Hope this helps

我已经安装了JFB Connect扩展,因此我只使用了{SCOpenGraph image = PATH} JFB短代码来更改旧的元数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM