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.

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.

  • 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 '16 at 6:22
  • yes you have to put inside theme default.xml file and its working as per your requirement then accept answer. – Rakesh Jesadiya Apr 23 '16 at 6:25
  • NO it is not changing – Ramya Apr 23 '16 at 6:48
  • Have you clear cache? – Rakesh Jesadiya Apr 23 '16 at 6:51
  • yes i cleared the cache – Ramya Apr 23 '16 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

  • How to rearrange the order of these links? – Ramya Apr 23 '16 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

  • 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 '16 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, privacy policy and cookie policy

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