0

How to add custom meta tag in head tag of page-layout-2columns-left

custom meta tag l want to add is

<meta property="og:image" itemprop="image" content="url"/>

P.S.

I want this url to be dynamic which change on page to page.

0

You can do it by update page_layout/2columns-left.xml

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
  <head>
    <meta property="og:image" itemprop="image" content="url"/>
  </head>
.......
.......
</layout>
  • i had updated question again. i wanted this url to be dynamic for page to page – Pradeep Sanku May 18 '18 at 14:23
0

You can use

head.additional
and add a new block with a custom class and custom phtml

<referenceBlock name="head.additional">
    <block class="Vendor\Module\Block\CustomHead" name="custom_head" template="Vendor_Module::custom_head.phtml"/>
</referenceBlock>

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.