How to add custom link (on custom module, not at theme) at header in magento 2
1 Answer
Create default.xml
file in your custom module.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="header.links">
<block class="Vendor_name\Module_name\Block\Link" name="some_link" before="-">
<arguments>
<argument name="label" xsi:type="string" translate="true">Custom link</argument>
<argument name="path" xsi:type="string">test</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
it will display in header links
-
Could you please post screen-shot where exactly it will show? Apr 16, 2018 at 13:36
-