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.

  • Contact Us
  • Home
  • 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

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.

  • Customization
    Customization Guides
  • Article Editor
  • Getting Started
    Managing Users Analytics Content Management Permissions & Accessibility Video Tutorials
  • Integrations
  • API & Webhooks
    API V2 API V3
  • Languages & Translations
  • Authentication
  • Swifty AI
  • Settings
    User Settings User Behavior Knowledge Base Settings Custom Domain
+ 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.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Overview: Customization
  • Shopify/Liquid Documentation
  • Shopify/Liquid Syntax
  • Shopify/Liquid Complete Objects Reference
One Knowledge Base To Replace Them All
24/5 support
Constant Product Updates & Improvements
100% money back guarantee
99.9% Uptime
Features
  • AI Knowledge Base AI-Enabled
  • Helpjuice Extension AI-Enabled
  • Powered Editor AI-Enabled
  • Advanced Analytics AI-Enabled
  • Customizable Themes AI-Enabled
  • Swifty · Helpbar & Chatbot AI-Enabled
  • Multi-Language Support
  • Step-by-Step Tutorial Creator
  • Seamless Integrations
  • User Access Control
  • See All Features >>
Product
  • Product Roadmap
  • Pricing
  • Book a Demo
  • Policies & Security
  • Our Customers
  • About Helpjuice
  • Contact Our Team
Resources
  • Our Knowledge Base
  • Webinars
  • Success Stories
  • API Documentation
  • Data Import Guide
  • Helpjuice Blog
Copyright © 2025, Helpjuice Inc.
Helpjuice, Inc. is a registered US Corporation.
EIN 46-2257741 | Download W9
Made in America High Performer Ease of Use Get Support
Get Started For Free
4.8 average review on
Life’s too short to use mediocre software.
+1 (833) 387 3877
Powered by Helpjuice Helpjuice Swifty AI External Link
Expand