What is the correct way to add block with some links and few css classes to header content?
This is correct?
<referenceContainer name="header-wrapper">
<container name="header.decor" as="headerDecor" label="Header Decor" htmlTag="div" htmlClass="header-decor">
<block class="Magento\Framework\View\Element\Html\Link" htmlClass="link-1" name="link-1">
<arguments>
<argument name="css_class" xsi:type="string">link-1</argument>
<argument name="path" xsi:type="string">link-1</argument>
</arguments>
</block>
<block class="Magento\Framework\View\Element\Html\Link" htmlClass="link-2" name="link-2">
<arguments>
<argument name="css_class" xsi:type="string">link-2</argument>
<argument name="path" xsi:type="string">link-2</argument>
</arguments>
</block>
</container>
</referenceContainer>
But no class…
Best Answer
In you "own theme" under
Magento_Theme/layout/default.xml
, add the following content.And add the HTML content inside
your_theme/Magento_Theme/templates/topCustomLinks.phtml