> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# メールテンプレートでサポートされる Liquid 構文

> メールテンプレートでサポートされる Liquid タグ、フィルター、および一般的な変数の一覧。

Liquid 構文の概要については、[LiquidJS introduction](https://liquidjs.com/tutorials/intro-to-liquid.html)を参照してください。そこでは、Liquid の 2 種類のマークアップについて簡潔に説明しています。

* **出力**。HTML を出力します。

  出力の構文は、`{{` と `}}` で囲まれた変数または値と、任意のフィルターのリストです。たとえば、`{{ user.name }}` です。

* **タグ**。テンプレートのレンダリングを制御し、ロジックを実装します。

  タグの構文は、`{%` と `%}` で囲まれたタグ名と任意の引数です。たとえば、`{% if user_metadata.lang == 'it' %} Ciao! {% endif %}` です。

このページでは、メールテンプレートでサポートされるタグ、フィルター、および変数を一覧で紹介します。

<div id="tags">
  ## タグ
</div>

すべてのメールテンプレートで、次の Liquid タグをサポートしています。

| Category | Tags                                    |
| -------- | --------------------------------------- |
| 反復       | `for`, `cycle`, `tablerow`              |
| 制御フロー    | `if`, `unless`, `elsif`, `else`, `case` |
| 変数       | `assign`, `increment`, `decrement`      |
| ファイル     | `include`, `layout`                     |
| 言語       | `raw`, `comment`                        |

Liquid タグの説明と使用例については、[LiquidJS tags page](https://liquidjs.com/tags/overview.html)を参照してください。

<div id="debug-tag">
  ### debug タグ
</div>

デバッグや開発を支援するために、カスタム `{% debug %}` タグは、テンプレートのレンダリング時にそのテンプレートで利用可能なテンプレート変数の概要を出力します。

<div id="filters">
  ## フィルター
</div>

すべてのメールテンプレートで、次の Liquid フィルターをサポートしています。

| カテゴリ     | フィルター                                                                                                                                                                                              |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 数学       | `plus`, `minus`, `modulo`, `times`, `floor`, `ceil`, `round`, `divided_by`, `abs`, `at_least`, `at_most`                                                                                           |
| 文字列      | `append`, `prepend`, `capitalize`, `upcase`, `downcase`, `strip`, `lstrip`, `rstrip`, `strip_newlines`, `split`, `replace`, `replace_first`, `remove`, `remove_first`, `truncate`, `truncatewords` |
| HTML/URI | `escape`, `escape_once`, `url_encode`, `url_decode`, `strip_html`, `newline_to_br`                                                                                                                 |
| 配列       | `slice`, `map`, `sort`, `sort_natural`, `first`, `last`, `join`, `reverse`, `size`                                                                                                                 |
| 日付       | `date`                                                                                                                                                                                             |
| その他      | `default`                                                                                                                                                                                          |

Liquid フィルターの説明と例は、[LiquidJS の filters ページ](https://liquidjs.com/filters/overview.html)で確認できます。

<div id="general-variables">
  ## 一般的な変数
</div>

以下の変数は、すべてのテンプレートの **From Address**、**Subject**、**Message** フィールドで使用できます (特記がある場合を除く) 。

信頼できないプロパティをメールテンプレートで使用する場合は、`escape` フィルターを使用してエスケープしてください (例: `{{ user.name | escape }}`) 。

* `application.name` や `application.client_metadata` など、標準的なクライアントプロパティにアクセスできる `application` オブジェクト

* ユーザーの言語選択を表す `request_language`

* `connection.name`

<Warning>
  - MFA 登録メールテンプレートでは、`connection.name` 変数は使用できません。
</Warning>

* [Tenant Settings](https://manage.auth0.com/#/tenant) で定義されるテナント関連の情報:
  * 生のテナント名である `tenant`
  * `friendly_name`
  * `support_email`
  * `support_url`

* 以下の `user` 変数:
  * `user.email`
  * `user.email_verified`
  * `user.picture` (**信頼できない**)
  * `user.nickname` (**信頼できない**)
  * `user.given_name` (**信頼できない**)
  * `user.family_name` (**信頼できない**)
  * `user.name` (**信頼できない**)
  * `user.app_metadata`。アプリケーションの動作やユーザーがアクセスできる対象など、ユーザーの中核機能に影響する可能性があるユーザー属性です。これには、サポートプラン、セキュリティロール、アクセス制御グループが含まれます
  * `user.user_metadata` (ユーザー提供の情報を含む場合は **信頼できない**) 。ユーザー設定など、ユーザーの中核機能には影響しないユーザー属性です

<Warning>
  パスワードレス OTP メールテンプレートでは、`user` オブジェクトの `email` プロパティのみ使用できます。
</Warning>

* ユーザーが [組織](/ja/docs/manage-users/organizations/organizations-overview) を通じてログインした場合は、以下の追加変数を使用できます:
  * `organization.id`
  * `organization.display_name`
  * `organization.name`
  * `organization.metadata`
  * `organization.branding.logo_url`
  * `organization.branding.colors.primary`
  * `organization.branding.colors.page_background`

* 複数の <Tooltip tip="Custom Domain: 特殊な名前、またはバニティ名を持つサードパーティドメイン。" cta="用語集を表示" href="/ja/docs/glossary?term=custom+domains">カスタムドメイン</Tooltip> 変数:

  * `custom_domain.domain`。使用中のカスタムドメイン名 (例: `login.example.com`)
  * `custom_domain.domain_metadata`。ドメインに応じてメールコンテンツをカスタマイズするために使用できる、カスタムドメインのメタデータフィールド (キーと値のペア) です

[複数のカスタムドメイン](/ja/docs/customize/custom-domains/multiple-custom-domains) を使用する場合、Auth0 はメールリンクに適切なカスタムドメインを自動的に使用します。これらの変数を使うと、どのカスタムドメインがメールのトリガーになったかに応じてメールコンテンツをカスタマイズできます。

**例**: カスタムドメインのメタデータに基づいてメールのブランディングをカスタマイズする:

```liquid theme={null}
{% if custom_domain.domain_metadata.brand == "BrandA" %}
  <h1 style="color: #0000FF;">Welcome to Brand A</h1>
{% elsif custom_domain.domain_metadata.brand == "BrandB" %}
  <h1 style="color: #FF0000;">Welcome to Brand B</h1>
{% else %}
  <h1>Welcome</h1>
{% endif %}
```

**例**: ドメイン固有のサポート情報を含める:

```liquid theme={null}
{% if custom_domain.domain_metadata.support_email %}
  <p>Need help? Contact us at {{ custom_domain.domain_metadata.support_email }}</p>
{% else %}
  <p>Need help? Contact us at {{ support_email }}</p>
{% endif %}
```

メールでカスタムドメインを使用するには、次の項目を確認してください。

1. [カスタムドメイン](/ja/docs/customize/custom-domains) の設定と検証が完了していること
2. **Dashboard** > **Branding** > **Custom Domains** で **Use Custom Domain in Emails** を有効にしていること
3. 複数のカスタムドメインを使用している場合は、[default custom domain](/ja/docs/customize/custom-domains/multiple-custom-domains/default-domain) を設定していること

<div id="redirect-to-variables">
  ### Redirect To 変数
</div>

**Redirect To** URL フィールドを含むメールテンプレートでは、サポートされている変数は次の 3 つのみです。

* `application.name` (または同義語の `client.name`)
* `application.clientID`
* `application.callback_domain` (または同義語の `client.callback_domain`) 。これには、アプリケーションの **Allowed Callback URL** リストで最初に指定された URL のオリジンが含まれます。これはオリジンであるため、ドメインに加えてプロトコル (`https://` など) も含まれます。

  コールバックドメインを使用すると、`{{ application.callback_domain }}/result_page` のような構文を使って、Action をトリガーしたアプリケーション内のパスにユーザーをリダイレクトできます。

<div id="template-specific-variables">
  ## テンプレート固有の変数
</div>

すべてのメールテンプレートで利用できる共通の Liquid 変数に加え、以下のメールテンプレートでは追加の変数も利用できます。

<div id="blocked-account-email-template-variables">
  ### ブロック済みアカウントのメールテンプレートの変数
</div>

* `user.source_ip`
* `user.city`
* `user.country`
* `url`、アカウントのブロック解除用リンク

<div id="change-password-code-email-template-variables">
  ### パスワード変更 (code) メールテンプレートの変数
</div>

* `code`、パスワード変更用の code

<div id="change-password-link-email-template-variables">
  ### パスワード変更 (リンク) メールテンプレートの変数
</div>

* `url`：パスワードリセット用のリンク

<div id="mfa-enrollment-email-template-variables">
  ### MFA登録メールテンプレートの変数
</div>

* `link`：MFA登録リンク。

<div id="passwordless-otp-email-template-variables">
  ### パスワードレスOTPメールテンプレートの変数
</div>

* `send`。値は、要求されたパスワードレスメールの種類に応じて `link`、`link_ios`、`link_android`、または `code` になります
* `code`。アプリケーションにアクセスするためのワンタイムコード
* `link`。ユーザーがクリックしてアプリケーションにアクセスできるリンク (リンク形式のパスワードレスメールの場合のみ)
* `operation`。パスワードレスのメールアドレス変更操作では、値は `change_email` になります

<div id="user-invitation-email-template-variables">
  ### ユーザー招待メールのテンプレート変数
</div>

* `inviter.name`
* `roles.id`
* `roles.name`
* `roles.description`

<div id="verification-email-code-template-variables">
  ### 確認メール (code) テンプレート変数
</div>

* `code`、確認コード

<div id="verification-email-link-template-variables">
  ### 確認メール (リンク) テンプレート変数
</div>

* `url`、確認リンク
