Log in Sign up

Suppress header on homepage

Does Blot serve something like a page ID that would allow me to suppress the header on a particular page using .page-id-x #header {display: none;}? Specifically I'm hoping to display the header on all pages apart from the homepage at '/'.


3 years ago, 4 replies   Edit question

Are you using a landing page on your homepage?

In either case, you'll want to add a condition to your template's header section (typically stored in header.html) which will hide the header.

For example, let's say your header looks like this:

<div class="header">
...
</div>

To hide it only on the homepage you could do this:

{{^entries.length}}
<div class="header">
...
</div>
{{/entries.length}}

Anyway, if you tell me:

  • which template you are using
  • whether you are using a landing page

I'd be happy to provide specific instructions.

Answered 3 years ago · Edit answer

I've customised (and renamed) the template quite a bit over the years, but I believe the starting point was Diary. I am indeed using a landing page at '/', which links out to '/page/1' etc., but it's that landing page where I would like the option to not show the header. Thanks.

Answered 3 years ago · Edit answer

Ok, great. Well then I'd suggest doing the following:

  1. In your landing page file, add the following line at the very start:
Hide header: yes
  1. Open up header.html in your custom template and insert the following above the first line: {{^entry.metadata.hide header}} and the following after the last line {{/entry.metadata.hide header}}. Your header.html file should look something like this:
{{^entry.metadata.hide header}}
<div class="header">
...
</div>
{{/entry.metadata.hide header}}

Does that get you sorted? Please let me know if you have any questions

Answered 3 years ago · Edit answer

That works perfectly, thank you. And presumably it will work for any page to which I add the custom metadata. Blot wins again! (Thanks David)

Answered 3 years ago · Edit answer