1

I want to edit the Footer links in Magento 2. I have installed magento 2.0.2(with sample data). At backend, when I go to content/blocks I don't see any blocks there (the page is empty with no blocks). But when I open the frontend , footer links are available.I don't know from which file are they coming from. Someone please guide me with explanation to edit and rearrange the footer links.

1
  • how to add several links in a row? I would like add 4 url link pages <referenceBlock name="footer_links"> <referenceBlock name="privacy-policy-link" remove="true" /> <referenceBlock name="search-term-popular-link" remove="true" /> <referenceBlock name="contact-us-link" remove="true" /> <referenceBlock name="catalog-search-advanced-link" remove="true" /> <referenceBlock name="sales-guest-form-link" remove="true" /> <block class="Magento\Framework\View\Element\Html\Link\Current" name="test"> <arguments> <argument name="label" xsi:type="string" translate="true">test</argument> <argument name="pat Jan 25, 2021 at 19:34

4 Answers 4

6

All footer links are coming from default.xml files.

Privacy and cookie policy link: vendor/magento/module-cms/view/frontend/layout/default.xml
Search Terms link: vendor/vendor/magento/module-search/view/frontend/layout/default.xml
Contact us link: vendor/magento/module-contact/view/frontend/layout/default.xml
Order and Returns link: vendor/magento/module-sales/view/frontend/layout/default.xml
Advanced search link: vendor/magento/module-catalog-search/view/frontend/layout/default.xml

Here Sample code for rearrange footer links.

Contact Us
Privacy and Cookie Policy
Advanced Search
Orders and Returns
Search Terms

For rearrange position you have to do code below inside theme default.xml file.

 <referenceBlock name="footer_links">            
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="privacy-policy-link" after="contact-us-link">
                <arguments>
                    <argument name="label" xsi:type="string">Privacy and Cookie Policy</argument>
                    <argument name="path" xsi:type="string">privacy-policy-cookie-restriction-mode</argument>
                </arguments>
            </block>
             <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="catalog/seo/search_terms" name="search-term-popular-link" after="sales-guest-form-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Search Terms</argument>
                    <argument name="path" xsi:type="string">search/term/popular</argument>
                </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="contact/contact/enabled" name="contact-us-link" before="-">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Contact Us</argument>
                    <argument name="path" xsi:type="string">contact</argument>
                </arguments>
            </block>
             <block class="Magento\Sales\Block\Guest\Link" name="sales-guest-form-link" after="catalog-search-advanced-link">
                <arguments>
                    <argument name="label" xsi:type="string">Orders and Returns</argument>
                    <argument name="path" xsi:type="string">sales/guest/form</argument>
                </arguments>
            </block>
             <block class="Magento\Framework\View\Element\Html\Link\Current" name="catalog-search-advanced-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Advanced Search</argument>
                    <argument name="path" xsi:type="string">catalogsearch/advanced</argument>
                    <argument name="attributes" xsi:type="array">
                        <item name="data-action" xsi:type="string">advanced-search</item>
                    </argument>
                </arguments>
            </block>
        </referenceBlock>

You can do as per your requirement using before or after method and change position.

7
  • Should I put the above code in default.xml file of app/design/frontend/<my_package>/<my_theme>/Magento_theme/layout by inheriting it from vendor?
    – Ramya
    Apr 23, 2016 at 6:22
  • yes you have to put inside theme default.xml file and its working as per your requirement then accept answer. Apr 23, 2016 at 6:25
  • NO it is not changing
    – Ramya
    Apr 23, 2016 at 6:48
  • Have you clear cache? Apr 23, 2016 at 6:51
  • yes i cleared the cache
    – Ramya
    Apr 23, 2016 at 7:04
1

This footer links are coming from different module layout. Like:

Privacy-cookie: magento2/magento/module-cms/view/frontend/layout/default.xml
Search Terms : magento2/vendor/magento/module-search/view/frontend/layout/default.xml
Contact: magento2/magento/module-contact/view/frontend/layout/default.xml
Advance search: magento2/magento/module-catalog-search/view/frontend/layout/default.xml
Order Returns: magento2/magento/module-sales/view/frontend/layout/default.xml

Hope you will understand now! Happy learning

1
  • How to rearrange the order of these links?
    – Ramya
    Apr 23, 2016 at 5:53
0

Footer links are found in particular module defualt.xml under <referenceBlock name="footer_links"> tag.

For Example for the Privacy and Cookie Policy, You can change it from - magento2/vendor/magento/module-cms/view/frontend/layout/default.xml

1
  • when I edit my layout file by overriding them in my theme. The changes are not applied. But when I edit them inside the vendor/Magento/modules/view/frontend/layout changes are eshtablished.
    – Ramya
    Apr 23, 2016 at 8:29
0
<referenceBlock name="footer_links">
    <referenceBlock name="privacy-policy-link" remove="true" />
    <referenceBlock name="search-term-popular-link" remove="true" />
    <referenceBlock name="contact-us-link" remove="true" />
    <referenceBlock name="catalog-search-advanced-link" remove="true" />
    <referenceBlock name="sales-guest-form-link" remove="true" />

    <block class="Magento\Framework\View\Element\Html\Link\Current" name="test">
        <arguments>
            <argument name="label" xsi:type="string" translate="true">test</argument>
            <argument name="path" xsi:type="string">test</argument>
        </arguments>
    </block>
</referenceBlock>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.