Skip to content
Kong Docs are moving soon! Our docs are migrating to a new home. You'll be automatically redirected to the new site in the future. In the meantime, view this page on the new site!
Kong Logo | Kong Docs Logo
  • Docs
    • Explore the API Specs
      View all API Specs View all API Specs View all API Specs arrow image
    • Documentation
      API Specs
      Kong Gateway
      Lightweight, fast, and flexible cloud-native API gateway
      Kong Konnect
      Single platform for SaaS end-to-end connectivity
      Kong AI Gateway
      Multi-LLM AI Gateway for GenAI infrastructure
      Kong Mesh
      Enterprise service mesh based on Kuma and Envoy
      decK
      Helps manage Kong’s configuration in a declarative fashion
      Kong Ingress Controller
      Works inside a Kubernetes cluster and configures Kong to proxy traffic
      Kong Gateway Operator
      Manage your Kong deployments on Kubernetes using YAML Manifests
      Insomnia
      Collaborative API development platform
  • Plugin Hub
    • Explore the Plugin Hub
      View all plugins View all plugins View all plugins arrow image
    • Functionality View all View all arrow image
      View all plugins
      AI's icon
      AI
      Govern, secure, and control AI traffic with multi-LLM AI Gateway plugins
      Authentication's icon
      Authentication
      Protect your services with an authentication layer
      Security's icon
      Security
      Protect your services with additional security layer
      Traffic Control's icon
      Traffic Control
      Manage, throttle and restrict inbound and outbound API traffic
      Serverless's icon
      Serverless
      Invoke serverless functions in combination with other plugins
      Analytics & Monitoring's icon
      Analytics & Monitoring
      Visualize, inspect and monitor APIs and microservices traffic
      Transformations's icon
      Transformations
      Transform request and responses on the fly on Kong
      Logging's icon
      Logging
      Log request and response data using the best transport for your infrastructure
  • Support
  • Community
  • Kong Academy
Get a Demo Start Free Trial
Contribution guidelines
  • Home icon
  • Style guide and contribution guidelines
  • Conditional rendering
github-edit-pageEdit this page
report-issueReport an issue
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Kong AI Gateway
  • Plugin Hub
  • decK
  • Kong Ingress Controller
  • Kong Gateway Operator
  • Insomnia
  • Kuma

  • Docs contribution guidelines
  • Contribution guidelines
  • Style guidelines
    • Style guide
    • Word choice and naming
    • Notes and other notices
    • Diagrams
    • Documenting user interfaces
    • Contribution templates
    • Plugin documentation
      • Documenting Kong-owned plugins
      • Documenting partner plugins
  • Markdown rules and formatting
    • Markdown rules
    • Reusable content
    • Variables
    • Single-sourced versions
    • Single-sourced plugins
    • Conditional rendering
  • Community
    • Welcome to the Kong Docs community
    • Community expectations
    • Hackathons
enterprise-switcher-icon Switch to OSS
On this pageOn this page
  • Conditionally render content by product
  • Conditionally render content by version
    • Table rows
    • Whitespace control
    • Front matter

Conditional rendering

The Kong docs support conditional rendering based on the following:

  • Product
  • Product version

Conditionally render content by product

If you have content that needs to be reused between multiple products, you can conditionally render parts of that for a specific product:

This sentence is visible for every product that the content is used in.

{% unless page.edition == "konnect" %}
This will be hidden for Konnect.
{% endunless %}

{% if page.edition == "gateway" %}
This will show only for Kong Gateway.
{% endif %}

You can find all the supported editions in the app/_data/kong_versions.yml metadata file.

Conditionally render content by version

You can use conditional rendering by version for any content in the app/_src or app/_hub directories.

As we add new functionality, we want content on a page to be displayed only for specific releases of a product. You can use the if_version block for this.

if_version supports the following filters:

  • eq: Render content that equals the provided version. It also supports a comma-separated list of values, i.e. if_version eq:1.1.x,1.3.x
  • neq: Render content that does not equal the provided version.
  • gte: Render content that is equal or greater than the provided version.
  • lte: Render content that is equal or less than the provided version.

For example, eq displays content for only one specific version:


{% if_version eq:1.11.x %}
This will only show for version 1.11.x
{% endif_version %}

Greater than (gte) and less than (lte) are inclusive of the version provided:


{% if_version gte:1.11.x %}
This will only show for version 1.11.x and later (1.12.x, 2.0.0 etc)
{% endif_version %}


{% if_version gte:1.11.x lte:1.19.x %}
This will show for versions 1.11.x through 1.19.x, inclusive
{% endif_version %}

Table rows

When working with tables, you can set a conditional filter for a given row. The filter expects new lines before and after if_version:

| Name  | One         | Two    |
|-------|-------------|--------|
| Test1 | Works       | Shows  |


{% if_version gte: 1.11.x %}
| Test2 | Conditional | Hidden |
{% endif_version %}


| Test1 | Works       | Shows  |

The above will be rendered as a single table.

Whitespace control

if_version uses the same implementation as Liquid’s if tag. Therefore, it has the same whitespace control.

When rendering lists with if_version or if, there’s a caveat: you must add a hyphen to the right side of the tags (for consistency, it could be either side) to render them correctly.

* Item 1
{% if_version gte:3.6.x -%}
* Item 2
{% endif_version -%}
* Item 3

Front matter

You may want to set values in a page’s front matter conditionally. You can do this using overrides:

---
title: Page Here
alpha: false # This is the default, but is here for completeness

overrides:
  alpha:
    true:
      gte: 2.3.x
      lte: 2.5.x
---

In the above example, versions 2.3.x, 2.4.x and 2.5.x will have alpha: true, and all other versions will have alpha: false.

You can set the key to any scalar value. Here’s an example using strings to switch something from “Private Beta” (2.8.x and earlier) to GA (anything later than this).

---
title: Another Page
availability: GA

overrides:
  availability:
    Private Beta:
      lte: 2.8.x
---
Thank you for your feedback.
Was this page useful?
Too much on your plate? close cta icon
More features, less infrastructure with Kong Konnect. 1M requests per month for free.
Try it for Free
  • Kong
    Powering the API world

    Increase developer productivity, security, and performance at scale with the unified platform for API management, service mesh, and ingress controller.

    • Products
      • Kong Konnect
      • Kong Gateway Enterprise
      • Kong Gateway
      • Kong Mesh
      • Kong Ingress Controller
      • Kong Insomnia
      • Product Updates
      • Get Started
    • Documentation
      • Kong Konnect Docs
      • Kong Gateway Docs
      • Kong Mesh Docs
      • Kong Insomnia Docs
      • Kong Konnect Plugin Hub
    • Open Source
      • Kong Gateway
      • Kuma
      • Insomnia
      • Kong Community
    • Company
      • About Kong
      • Customers
      • Careers
      • Press
      • Events
      • Contact
  • Terms• Privacy• Trust and Compliance
© Kong Inc. 2025