I have a _layout which includes a contact button: {% include '_contact-button' %}

This creates a small contact button in the bottom right of every page that when clicked expands into a contact form. I would like this to be on every page of the site except the Contact page as it has it's own contact form. Is there a way in the contact template to not include _contact-button while still using _layout? Something like {% dontInclude '_contact-button' %}?


Try putting it inside of a simple block as the default value...

{% block contactButton %}
    {% include '_contact-button' %}
{% endblock %}

Then on your one-off page, override that block with emptiness...

{% block contactButton '' %}

Untested, but that should do the trick!

| improve this answer | |
  • Ah I didn't realise you could override a block. That worked great. Thanks Lindsey! – patrick.altair Mar 5 '18 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.