Documentation
Feedback
Guides
Storefront Development

Storefront Development
Store Framework
Building pages
Customizing the Header and Footer blocks by page

The Header and Footer are the two blocks that come up the most during a user's store navigation. From the homepage to the product page, from checkout to the Order Placed page: whatever a template's content may be, these two blocks will probably be present.

With that constancy in mind, you just need to declare these blocks once in the blocks.jsonc file, in a template of your choosing (usually it's store.home).

This is only possible because both Header and Footer have been previously defined behind the scenes as default store interface elements, allowing the Framework to identify the Header and Footer block as default for any other templates as well.

You may, however, want to apply a Header configured differently onto your Homepage and keep the default Framework Header for the Order Placed page or you may even not want any Footer on your product pages.

All of the above and more may be easily customized in the Header and Footer blocks, by simply overwriting the specific automatic duplication and declaring the desired new configurations thereafter.

Step 1 - Overwriting automatic duplication

In the desired template, declare the code given as example below to overwrite the Header and Footer automatic duplication.

Remember to replace the {headerBlock} and {footerBlock} values with real block names. Also, replace the {templateName} value with a valid theme template, such as product, search#category and custom.


_10
{
_10
"store.{templateName}": {
_10
"parent": {
_10
"header": "{headerBlock}",
_10
"footer": "{footerBlock}"
_10
}
_10
}
_10
}

The code above works in scenarios where the Header and Footer will be overwritten. When overwriting just one of the two, keep the template's parent structure and determine which block will be customized. For example:


_10
{
_10
"store.{templateName}": {
_10
"parent": {
_10
"header": "{headerBlock}"
_10
}
_10
}
_10
}

Step 2 - Applying new customizations

The next step is to configure the previously declared blocks in accordance with what's desired for this template.

If you want to apply new customizations to the blocks, simply follow the usual flow explained in the Header and Footer documentation. For example:


_24
{
_24
"store.product": {
_24
"parent": {
_24
"header": "header#product"
_24
}
_24
},
_24
"header#product": {
_24
"blocks": [
_24
"header-layout.desktop",
_24
"header-layout.mobile"
_24
]
_24
},
_24
"header-layout.desktop": {
_24
"children": [
_24
"header-row#1-desktop"
_24
]
_24
},
_24
"header-row#1-desktop": {
_24
"children": ["telemarketing"],
_24
"props": {
_24
"fullWidth": true
_24
}
_24
}
_24
}

It is possible, however, that you don't want new configurations, but rather want to delete the blocks from the template. In such a scenario, you need to declare the desired blocks and leave the children blank, as shown in the following example:


_32
{
_32
"store.custom#noheaderfooter": {
_32
"parent": {
_32
"header": "header#empty",
_32
"footer": "footer#empty"
_32
},
_32
},
_32
"header#empty": {
_32
"blocks": [
_32
"header-layout.desktop#empty",
_32
"header-layout.mobile#empty"
_32
]
_32
},
_32
"header-layout.desktop#empty": {
_32
"children": []
_32
},
_32
"header-layout.mobile#empty": {
_32
"children": []
_32
},
_32
"footer#empty": {
_32
"blocks": [
_32
"footer-layout.desktop#empty",
_32
"footer-layout.mobile#empty"
_32
]
_32
},
_32
"footer-layout.desktop#empty": {
_32
"children": []
_32
},
_32
"footer-layout.mobile#empty": {
_32
"children": []
_32
}
_32
}

Done! Once you save the changes and link your app, you'll be able to see the new configurations for these blocks reflected onto the desired page.

Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page