> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/adapting-your-content.md).

# コンテンツの適応

さまざまなユーザー向けにコンテンツを最適化します

認証方法を設定すると、そのデータを使ってサイト内のコンテンツをさまざまなユーザー向けに調整できるようになります。

ドキュメントの多くの部分を調整したりパーソナライズしたりできます。たとえば次のようなものです:

* 非表示にする、または表示する [ページ](/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/content-structure/page.md)
* サイトを非表示にする、または表示する [バリアント](/docs/documentation/ja-gitbook-documentation/manage-your-site/site-structure/variants.md)
* サイトを非表示にする、または表示する [セクション](/docs/documentation/ja-gitbook-documentation/manage-your-site/site-structure/site-sections.md)
* 非表示にする、または表示する [ヘッダーリンク](/docs/documentation/ja-gitbook-documentation/manage-your-site/customization/layout-and-structure.md#header)
* 〜にパーソナライズされたコンテンツを追加する [インライン式](/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/variables-and-expressions.md)

### 条件エディタの使い方

条件エディタでは、ページ、バリアント、またはセクションを表示するか非表示にするかの条件を設定します。条件エディタを開くと、条件を [式](/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/variables-and-expressions.md) として記述でき、それがサイトの訪問者から送られてくるデータに対して実行されます。

<figure><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2FNQ8RM1GDU6HUyBKBp2wF%2F22_01_06_condition_editor%402x.png?alt=media&amp;token=137c61cd-52cf-4a7b-95a3-ab60c5992d3f" alt=""><figcaption></figcaption></figure>

#### 例

ユーザーを通じて GitBook に渡したデータは、 `visitor.claims`.

というオブジェクトに添付されます。次のような条件文を書きたい場合の例を見てみましょう。 **ベータプログラムの一員であるユーザーにのみページを表示する** と定義できます。

```javascript
visitor.claims.isBetaUser == true
```

上の式は、このクレームに一致するユーザー、つまり `isBetaUser` が `true` というユーザーのクレームを持つユーザーは、ページを表示してアクセスできます。このクレームに一致しないユーザー（クレームが設定されていない訪問者を含む）は、ページを表示したりアクセスしたりできません。

条件エディタにはオートコンプリートも組み込まれており、サイトの過去の訪問者で見つかったクレームや属性を提案して、ページ、バリアント、またはセクションの条件文の作成を支援します。

オートコンプリートを使うと、 [変数](/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/variables-and-expressions.md#use-variables-in-your-content) も使用できることに気づくでしょう。定義した変数と、ユーザーデータから取得したクレームを組み合わせて、条件式を書くことができます。たとえば、次のようにできます。

1. 製品の最新バージョン用の変数を設定する
2. 次に、訪問者がドキュメントのどのバージョンを使用しているかを示すクレームを設定する
3. 最後に、ユーザーがドキュメントの最新バージョンを使っているときだけ特定のページを表示する式を書く

有効な JavaScript として書かれている限り、さまざまな種類の式を書くことができます。たとえば、複数のクレームを条件エディタに組み合わせて、 `&&` または `||` 演算子を使うことで、特定のユーザーに一致させることができます。演算子について詳しくは [こちら](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#binary_logical_operators).

### 人間の訪問者と AI エージェントを対象にする

組み込みの `visitor.type` プロパティを使って、人間と AI エージェントに異なるコンテンツを表示します。このプロパティには次の 2 つの値のいずれかが入ります。

* `human` 人間の訪問者の場合
* `agent` AI エージェントの場合

たとえば、この条件を使うと AI エージェントにのみコンテンツを表示できます。

```javascript
visitor.type === "agent"
```

次の条件を使うと、人間の訪問者にのみコンテンツを表示できます。

```javascript
visitor.type === "human"
```

### セグメントを使ったテスト

セグメントは、条件をテストするために設定できるモックユーザーデータを表します。

たとえば、エンタープライズプランの開発者や、無料プランのサインイン済みユーザーを表すセグメントを設定し、その人に表示されるページを確認できます。

[セグメントの設定と使用について詳しくは、こちらをご覧ください。](/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/testing-with-segments.md)

### 条件付きページ

ページの条件エディタを起動するには、そのページの横にあるアクションメニューへ移動し、 <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F89MTSo5XRpPMVr1T0rxS%2Factions.svg?alt=media&amp;token=2b5d001e-560a-4f29-8d22-de8163725ca1" alt="The Actions menu icon in GitBook"></picture> をクリックします **条件を追加。** 条件エディタは、 [ページのオプション](/docs/documentation/ja-gitbook-documentation/rifarensu/gitbook-ui.md#page-options).

ページ条件アイコンがページに付いていれば、セクション内のどのページに条件が設定されているかを確認できます。 <picture><source srcset="/files/QtQtLiYwc1oJj119cgUz" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F51vQZhUqnkdsYpyUo1Pj%2Fpage-condition.svg?alt=media&amp;token=31dd334a-5097-4081-915c-db460e610ec6" alt="The Page condition icon in GitBook"></picture> その横に。

### 条件付きバリアント

バリアントの条件エディタを起動するには、そのバリアントの横にあるアクションメニューへ移動し、 <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F89MTSo5XRpPMVr1T0rxS%2Factions.svg?alt=media&amp;token=2b5d001e-560a-4f29-8d22-de8163725ca1" alt="The Actions menu icon in GitBook"></picture> をクリックします **条件を追加**.

バリアントにページ条件アイコンが付いていれば、ドキュメント内のどのバリアントに条件が設定されているかを確認できます <picture><source srcset="/files/QtQtLiYwc1oJj119cgUz" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F51vQZhUqnkdsYpyUo1Pj%2Fpage-condition.svg?alt=media&amp;token=31dd334a-5097-4081-915c-db460e610ec6" alt="The Page condition icon in GitBook"></picture> その横に。

### 条件付きセクション

セクションの条件エディタを起動するには、そのセクションの横にあるアクションメニューへ移動し、 <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F89MTSo5XRpPMVr1T0rxS%2Factions.svg?alt=media&amp;token=2b5d001e-560a-4f29-8d22-de8163725ca1" alt="The Actions menu icon in GitBook"></picture> をクリックします **条件を追加**.

セクションにページ条件アイコンが付いていれば、ドキュメント内のどのセクションに条件が設定されているかを確認できます <picture><source srcset="/files/QtQtLiYwc1oJj119cgUz" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F51vQZhUqnkdsYpyUo1Pj%2Fpage-condition.svg?alt=media&amp;token=31dd334a-5097-4081-915c-db460e610ec6" alt="The Page condition icon in GitBook"></picture> その横に。

### 条件付きページヘッダーリンク

ページヘッダーリンクの条件エディタを起動するには、そのリンクの横にあるアクションメニューへ移動し、 <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F89MTSo5XRpPMVr1T0rxS%2Factions.svg?alt=media&amp;token=2b5d001e-560a-4f29-8d22-de8163725ca1" alt="The Actions menu icon in GitBook"></picture> をクリックします **条件を追加**.

リンクにページ条件アイコンが付いていれば、ドキュメント内のどのリンクに条件が設定されているかを確認できます <picture><source srcset="/files/QtQtLiYwc1oJj119cgUz" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F51vQZhUqnkdsYpyUo1Pj%2Fpage-condition.svg?alt=media&amp;token=31dd334a-5097-4081-915c-db460e610ec6" alt="The Page condition icon in GitBook"></picture> その横に。

### インライン式

コンテンツの表示/非表示を制御するだけでなく、 [式](/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/variables-and-expressions.md)を使って、ページやスペースの変数と同じように、インラインでクレームを使用することもできます。

式を使ってインラインでクレームを参照するには、エディタで <kbd>/</kbd> と入力してから、 <picture><source srcset="/files/HArsBmu3qFWO2SuJx7oR" media="(prefers-color-scheme: dark)"><img src="https://4217681718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2FyV0YSeHof9IkW4nnHQ4C%2FExpression.svg?alt=media&amp;token=47e912c2-1ff1-4882-825f-5c3c79b4e6c0" alt=""></picture> **式**を選択します。クレームは、 `visitor` .

### Git Sync の使い方

GitBook で設定した条件は Git Sync を通じて同期され、同期された Markdown ページに表示されます。つまり、表示条件が設定されたブロックやページは、同期されたリポジトリでも引き続き表示されます。

クレームを通じて渡されるデータは Markdown には決して表示されず、安全に GitBook に渡されます。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/adaptive-content/adapting-your-content.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
