1

我知道如何使用“布局更新 XML”选项在Magento 1 CMS 页面中添加自定义元标记。

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

如何使用选项“布局更新 XML”以相同的方式为Magento 2中的特定 CMS 页面添加元标记

<meta data-customid="customid_meta_1" />
4

1 回答 1

0

我认为以下应该对你有用

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

您可能会看到vendor\magento\module-theme\view\frontend\layout\default_head_blocks.xml文件以供参考。

可以在以下文件app\design\frontend\rwd\default\layout\page.xml中找到相同元的 Magento1 代码

<!-- 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>

还要检查以下文件vendor\magento\framework\View\Page\Config\Renderer.php以获得getMetadataTemplate方法

更新:在布局更新 xml 中 检查CMS 页面

于 2018-01-16T12:13:01.860 回答