cancel
Showing results for 
Search instead for 
Did you mean: 

default.xml Footer link changes only appearing on home page

default.xml Footer link changes only appearing on home page

I have tried modifying the default.xml file under /{magento_root}/app/design/frontend/{app}/{theme}/Magento_Theme/layout with the following to remove some links and add others:

 

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
	<referenceContainer name="footer">
		<block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="Magento_Store::switch/stores.phtml"/>
		<referenceBlock name="search-term-popular-link" remove="true"/>
		<referenceBlock name="catalog-search-advanced-link" remove="true"/>
		<referenceBlock name="sales-guest-form-link" remove="true"/>
		<!-- <referenceBlock name="privacy-policy-link" remove="true"/> -->
		<referenceBlock name="contact-us-link" remove="true"/>
		   <referenceBlock name="footer_links">
			 <block class="Magento\Framework\View\Element\Html\Link\Current" name="return-policy">
				 <arguments>
					 <argument name="label" xsi:type="string">Return Policy</argument>
					 <argument name="path" xsi:type="string">return-policy</argument>
				 </arguments>
			 </block>
			 <block class="Magento\Framework\View\Element\Html\Link\Current" name="terms-and-conditions">
				 <arguments>
					 <argument name="label" xsi:type="string">Terms and Conditions</argument>
					 <argument name="path" xsi:type="string">terms-and-conditions</argument>
				 </arguments>
			 </block>
			 <block class="Magento\Framework\View\Element\Html\Link\Current" name="contact-us">
				 <arguments>
					 <argument name="label" xsi:type="string">Contact Us</argument>
					 <argument name="path" xsi:type="string">contact</argument>
				 </arguments>
			 </block>
		 </referenceBlock>
	</referenceContainer>
</body>
</page>

This works fine for the main home page, which shows:

    Privacy and Cookie Policy
    Return Policy
    Terms and Conditions
    Contact Us

  All other pages, however, still shows the default links:

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

 

How do I get the default.xml in my own theme to apply across all pages in the site?

 

Currently using Magento Community 2.3.2 with my custom theme being a luma theme child.

 

4 REPLIES 4

Re: default.xml Footer link changes only appearing on home page

Hi @ZW1111 

 

I understand the functionality which you are trying to achieve.

 

Basically here you would require to remove block called footer_blocks and add the links which you want which reflects on all the pages.

 

I would recommended to follow this link to resolve the issue - https://magento.stackexchange.com/questions/93628/magento-2-remove-and-change-footer-links 

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

Re: default.xml Footer link changes only appearing on home page

Thanks for the reply...  The link you supplied is actually the link I was using as a reference for my changes.  I have done what it states as far as i can tell. I'm not sure why it would apply to the main page, but none of the other pages.

 

I am not sure what you mean by "remove block called footer_blocks"?  Is that removed using the default.xml as well?

 

I am using a magento install with no sample data at all, so there are no blocks currently define in the Content > Blocks section...

 

By the way, my original default.xml only had the following, which also works only for the home page:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>

        <referenceBlock name="search-term-popular-link" remove="true"/>
        <referenceBlock name="catalog-search-advanced-link" remove="true"/>
        <referenceBlock name="sales-guest-form-link" remove="true"/>
        <!-- <referenceBlock name="privacy-policy-link" remove="true"/> -->
        <referenceBlock name="contact-us-link" remove="true"/>
       <referenceBlock name="footer_links">
         <block class="Magento\Framework\View\Element\Html\Link\Current" name="return-policy">
             <arguments>
                 <argument name="label" xsi:type="string">Return Policy</argument>
                 <argument name="path" xsi:type="string">return-policy</argument>
             </arguments>
         </block>
         <block class="Magento\Framework\View\Element\Html\Link\Current" name="terms-and-conditions">
             <arguments>
                 <argument name="label" xsi:type="string">Terms and Conditions</argument>
                 <argument name="path" xsi:type="string">terms-and-conditions</argument>
             </arguments>
         </block>
         <block class="Magento\Framework\View\Element\Html\Link\Current" name="contact-us">
             <arguments>
                 <argument name="label" xsi:type="string">Contact Us</argument>
                 <argument name="path" xsi:type="string">contact</argument>
             </arguments>
         </block>
     </referenceBlock>
</body>
</page>

I only added the additional "<referenceContainer name="footer">" code later while troubleshooting, but the results did not change.

Re: default.xml Footer link changes only appearing on home page

I figured out the issue.  My categories had the Luma theme hard set under the "Design" area for each category.  When I cleared the theme for the categories, the settings I had in the default.xml applied across the pages.

Re: default.xml Footer link changes only appearing on home page

Hi

Glad to know your have figured out and your issue gets resolved

Happy to help and keep helping others Smiley Happy
if issue solved,Click Kudos & Accept as Solution