Answers:
我希望这对您有用
如果要删除 top.links
在此路径中添加default.xml文件
app / design / frontend / vendor / theme / Magento_Theme / layout / default.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="register-link" remove="true" /> <!--for Create Account Link-->
<referenceBlock name="authorization-link" remove="true" /> <!--for Sign In Link -->
<referenceBlock name="wish-list-link" remove="true" /> <!--for WishList Link-->
<referenceBlock name="my-account-link" remove="true" /> <!--for My Account Link-->
</body>
</page>
如果要添加自定义顶部链接:
转到app / design / frontend / vendor / theme / Magento_Theme / layout / default.xml
<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="Magento\Framework\View\Element\Html\Link" name="custom-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">custom link</argument>
<argument name="path" xsi:type="string" translate="true">customlink</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
您可以通过在Magento_Theme / layout / default.xml中添加此行来添加和删除顶部链接。
<referenceBlock name="header.links">
<block class="Magento\Framework\View\Element\Html\Link" name="new.link" after="register-link">
<arguments>
<argument name="label" xsi:type="string" translate="false">New Link</argument>
<argument name="path" xsi:type="string" translate="false">newlink</argument>
</arguments>
</block>
<!-- here you can remove whatever link you feel unwanted -->
<referenceBlock name="register-link" remove="true" /> <!--for Create Account Link-->
<referenceBlock name="authorization-link" remove="true" /> <!--for Sign In Link -->
<referenceBlock name="wish-list-link" remove="true" /> <!--for WishList Link-->
<referenceBlock name="my-account-link" remove="true" /> <!--for My Account Link-->
</referenceBlock>
header.links