US English (US)
BS Bosnian

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Book a Demo
  • Product Updates
  • Contact Us
English (US)
US English (US)
BS Bosnian
  • Home
  • Customization
  • Customization Guides

Contextual Sections Guide / Custom (Category) Pages

Contextual Sections are sections only displayed under certain circumstances

Written by Guilherme Arantes

Updated at October 18th, 2023, by Amanda Stançani

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Users Accessibility New to Helpjuice? Start Here Content Management Multiple Languages/Translations & Localization Multilingual Knowledge Bases Analytics Video Tutorials
  • Customization
    Customization Guides
  • API V2
  • API V3 and Webhooks
  • Article Editor
  • Billing / Subscription
  • Authentication
  • Pricing
  • Swifty AI Chatbot
  • Swifty AI Helpbar
  • What's New
+ More

It is possible to hide or show different parts of your template according to the current page being accessed using Liquid Tags. You can create Contextual Sections within any template file; for instance, to create a Contact Us Section on the Main Layout, you can use something similar to this code:

{% if on_show_question_page %}
  <!-- content for question page -->
{% elsif on_index_page %}
  <!-- content for index page -->
{% elsif on_contact_us_page %}
  <!-- content for contact page -->
{% elsif category != null %}
  <!-- content for category page -->
{% else %}
  <!-- content for thanks page -->
{% endif %}

Here is a complete example on how to create a custom navigation section only on the Index Page:

{% if on_index_page %}
  <ul id="navigation">
    {% for categories on roots_categories %}
      <li><a href="{{ categories.url }}">{{ categories.name }}</a></li>
    {% endfor %}
  </ul>
{% endif %}

One another example is to list the Top Questions:

{% if on_index_page or on_question_page %}
  <ul id="top_questions">
    {% for questions in top_questions | limit: 5 %}
      <li>
        <a href="{{ questions.url }}">{{ questions.name }}</a>
        <p>{{ questions.description }}</p>
      </li>
    {% endfor %}
  </ul>
{% endif %}

Check the Shopify/Liquid Documentation to ‍view the complete list of Liquid Objects and Syntax and the Standard Sections‍ to view the Standard Sections references.

customizing contextualizing

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Overview: Customization
  • Shopify/Liquid Complete Objects Reference
  • Shopify/Liquid Documentation
  • Shopify/Liquid Syntax

Copyright © 2025 - Helpjuice

Helpjuice, Inc. is a registered US Corporation, EIN # 45-2275731

Download W9
  • Help
  • Features
  • Pricing
  • About
  • Careers
  • Customers
  • Blog
  • Case Studies
  • Resources
  • Knowledge Base Examples
  • Privacy Policy
  • Terms of Service

Why is the knowledge base important?

With a knowledge base, you can allow your customers to self-help themselves, thus reducing your customer support by up to 60%. Furthermore, you can also have your team get instant answers to the questions they need without having to email themselves all using knowledge base software.

What is the purpose of a knowledge base?

The purpose of knowledge base software is to allow you to host your knowledge base/corporate wiki in one centralized 'hub'. Both your customers, and employees can now access information within seconds!

Made with from Miami, Bosnia, Morocco & Brasil

+1 (833) 387 3877 support@helpjuice.com
Expand