Hide sections Announcement bar, Header and Footer from a template

luigi-ib
Shopify Partner
19 0 6

Hi Shopify community,

 

I'm using the official theme Dawn and in some page templates I need to hide to the user the sections  Announcement bar, Header and Footer.

 

I already tried the following methods:

  • In the section used by the above mentioed page, I hide these section by using CSS rule display: none. The con of this approach are some glitches due to the fact that browser processes the CSS rules of the main theme (where sections are visibile) before CSS rules of the section (where sections are hidded).
  • In the file theme.liquid I added an if block to hide the sections according to the given template name. The con of this approach is the maintenance of this piece of code every time I update or I create a new page that depends on this logic and the code "pollution" of theme.liquid.
  • I created a new layout for these kind of pages from theme.liquid without the sections "Announcement bar", "Header" and "Footer". The con of this approach is syncing of common parts with theme.liquid.

 

Do you have any other idea to manage this effectively?

Replies 0 (0)