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 a year 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 a year 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 a year 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 a year ago · Improve this answer

Markdown allowed
Question or feedback?
Contact us

Tags

developers 28 questions bug 14 questions posts 9 questions resolved 7 questions request 6 questions google-drive 5 questions configure 4 questions pages 3 questions added 3 questions meta 3 questions More tags →
Subscribe for changes
RSS Feed of latest questions