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 '/'.

4 replies

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 2 years ago · Improve this 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 2 years ago · Improve this 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 2 years ago · Improve this 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 2 years ago · Improve this answer

Markdown allowed
Question or feedback?
Contact us

Tags

developers 92 questions bug 48 questions posts 27 questions resolved 27 questions metadata 26 questions templates 24 questions how 14 questions tags 13 questions markdown 12 questions google-drive 10 questions More tags →
Subscribe for changes
RSS Feed of latest questions