9

Dear Joomla community,

I'm working on a little system plugin to inject Facebook Open Graph properties into an article. Therefore I've been using $document->setMetaData(). But now I discovered that this adds <meta name=""> tags to the header of the page, but Facebook expects <meta property=""> tags.

What's the easiest way to put a <meta property=""> tag into the page header?

Please explain in as much detail as possible, as I'm absolutely new to Joomla plugin developemnt.

Any advice is appreciated, Thank you.

9

Starting from Joomla 3.6 you can add 'property' attribute using setMetaData

$doc = JFactory::getDocument();
$doc->setMetaData('og:image', 'https://cdn.joomla.org/images/Joomla_logo.png', 'property');

Reference : https://github.com/joomla/joomla-cms/pull/10682

6

Never mind, I just discovered the mighty $document->addCustomTag() API call. Thanks you anyway!

  • Yes, this is convenient for adding Open Graph tags. – pl71 May 31 '15 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.