How to display content only if a specific page id is met?

Topic summary

Topic: Showing content on a specific Shopify page using Liquid conditions.

  • Problem: Attempts to conditionally render content using page.id or id with quoted strings and “contains” failed.

  • Key detail: In Shopify Liquid, page.id is a numeric identifier (not a string), and comparisons should be direct equality, not “contains”.

  • Working solution: Use a numeric equality check.
    Example: {% if page.id == 49700733008 %} Show Content {% endif %}
    Explanation: Remove quotes and avoid “contains”; reference page.id, not id.

  • Alternative approach: To exclude a popup on a specific landing page, wrap the popup section with a title-based condition in theme.liquid.
    Example: Replace {%- sections ‘popup-group’ -%} with:
    {%- if page.title != “Enter Page Title” -%}
    {%- sections ‘popup-group’ -%}
    {%- endif -%}
    Note: This depends on page.title staying unchanged; page.id is more stable if title/handle may change.

  • Outcome: A correct code pattern using page.id was provided; thread appears resolved. Code snippets are central to understanding.

Summarized with AI on January 16. AI used: gpt-5.

Thanks mate !