I want to insert Facebook og:meta tags to use for facebook sharer ,in a head of a particular page and this page is not a CMS page.I am thinking of adding these tags through that extension layout file. I know normal titles and description are added like this ->
<reference name="head">
<action method="setTitle"><title>My Module Page</title></action>
</reference>
Does magento provides something like this for Facbook og:meta tags?If not ,what is/are the other method to put og:meta tags in the head of a page so that it work with facebook sharer.
<reference name="head">
<block type="core/text" name="blockname">
<action method="setText">
<text>
<![CDATA[<meta property="og:image" content="http://example.com/image.jpg"/>]]>
</text>
</action>
</block>
</reference>
Magento doesn't include an action to include these meta tags. Instead, you could create a template file (/app/design/frontend/mypackage/mytheme/page/html/facebookmeta.phtml) with your meta tags in it.
Then, add the following to your head
reference:
<block type="core/template" name="facebookmeta" template="page/html/facebookmeta.phtml" />
Clear your caches and you should see your block being included into the head for that particular page. It's not a particularly extendable solution, if you want to pass options to this template you should really create a new block, which requires creating a new module etc.
However, in your template file you can use PHP, so you should be able to get various variables you need, for example:
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName() ?>"/>
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With