1

I know how to add custom meta tag in a Magento 1 CMS page using 'Layout Update XML' option.

<reference name="head">
    <block type="core/text" name="custommeta">
        <action method="setText">
            <text>
                <![CDATA[<meta data-customid="customid_meta_1" />]]>
            </text>
        </action>
    </block>
</reference>

How I can add meta tag in the same way for a specific CMS page in Magento 2 using option 'Layout Update XML'

<meta data-customid="customid_meta_1" />

1 Answers1

0

I think following should work for you

<head>
    <meta name="data-customid" content="customid_meta_1"/>
</head>

you may see vendor\magento\module-theme\view\frontend\layout\default_head_blocks.xml file for reference.

Magento1 code for the same meta can be found in the following file app\design\frontend\rwd\default\layout\page.xml

<!-- Sets viewport meta tag using text block -->
<block type="core/text" name="head.viewport">
      <action method="setText"><text><![CDATA[<meta name="viewport" content="initial-scale=1.0, width=device-width" />]]>&#10;</text></action>
</block>

Also check following file vendor\magento\framework\View\Page\Config\Renderer.php for the getMetadataTemplate method

Update: check CMS Page with in layout update xml

Mukesh
  • 7,630
  • 21
  • 105
  • 159