コンテンツにスキップ
Kong Logo | Kong Docs Logo
  • ドキュメント
    • API仕様を確認する
      View all API Specs すべてのAPI仕様を表示 View all API Specs arrow image
    • ドキュメンテーション
      API Specs
      Kong Gateway
      軽量、高速、柔軟なクラウドネイティブAPIゲートウェイ
      Kong Konnect
      SaaSのエンドツーエンド接続のための単一プラットフォーム
      Kong AI Gateway
      GenAI インフラストラクチャ向けマルチ LLM AI Gateway
      Kong Mesh
      Kuma と Envoy をベースにしたエンタープライズサービスメッシュ
      decK
      Kongの構成を宣言型で管理する上で役立ちます
      Kong Ingress Controller
      Kubernetesクラスタ内で動作し、Kongをプロキシトラフィックに設定する
      Kong Gateway Operator
      YAMLマニフェストを使用してKubernetes上のKongデプロイメントを管理する
      Insomnia
      コラボレーティブAPI開発プラットフォーム
  • Plugin Hub
    • Plugin Hubを探索する
      View all plugins すべてのプラグインを表示 View all plugins arrow image
    • 機能性 すべて表示 View all arrow image
      すべてのプラグインを表示
      AI's icon
      AI
      マルチ LLM AI Gatewayプラグインを使用してAIトラフィックを管理、保護、制御する
      認証's icon
      認証
      認証レイヤーでサービスを保護する
      セキュリティ's icon
      セキュリティ
      追加のセキュリティレイヤーでサービスを保護する
      トラフィック制御's icon
      トラフィック制御
      インバウンドおよびアウトバウンドAPIトラフィックの管理、スロットル、制限
      サーバーレス's icon
      サーバーレス
      他のプラグインと組み合わせてサーバーレス関数を呼び出します
      分析と監視's icon
      分析と監視
      APIとマイクロサービストラフィックを視覚化、検査、監視
      変革's icon
      変革
      Kongでリクエストとレスポンスをその場で変換
      ログ記録's icon
      ログ記録
      インフラストラクチャに最適なトランスポートを使用して、リクエストと応答データをログに記録します
  • サポート
  • コミュニティ
  • Kongアカデミー
デモを見る 無料トライアルを開始
貢献ガイドライン
  • Home icon
  • Style guide and contribution guidelines
  • Conditional rendering
report-issue問題を報告する
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Kong AI Gateway
  • Plugin Hub
  • decK
  • Kong Ingress Controller
  • Kong Gateway Operator
  • Insomnia
  • Kuma

  • ドキュメント投稿ガイドライン
  • 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 次に切り替える: 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?
情報が多すぎる場合 close cta icon
Kong Konnectを使用すると、より多くの機能とより少ないインフラストラクチャを実現できます。月額1Mリクエストが無料。
無料でお試しください
  • Kong
    APIの世界を動かす

    APIマネジメント、サービスメッシュ、イングレスコントローラーの統合プラットフォームにより、開発者の生産性、セキュリティ、パフォーマンスを大幅に向上します。

    • 製品
      • Kong Konnect
      • Kong Gateway Enterprise
      • Kong Gateway
      • Kong Mesh
      • Kong Ingress Controller
      • Kong Insomnia
      • 製品アップデート
      • 始める
    • ドキュメンテーション
      • Kong Konnectドキュメント
      • Kong Gatewayドキュメント
      • Kong Meshドキュメント
      • Kong Insomniaドキュメント
      • Kong Konnect Plugin Hub
    • オープンソース
      • Kong Gateway
      • Kuma
      • Insomnia
      • Kongコミュニティ
    • 会社概要
      • Kongについて
      • お客様
      • キャリア
      • プレス
      • イベント
      • お問い合わせ
  • 利用規約• プライバシー• 信頼とコンプライアンス
© Kong Inc. 2025