Liquid Snippets by ALSEL
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_index オブジェクト

ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。

用途
ホームページ(`templates/index.liquid`)でセクションマネージャーで設定したセクションを描画するとき。テーマカスタマイザーから管理画面でセクションの追加・削除・順序変更を可能にする。
設置場所
`templates/index.liquid` 内に `{{ content_for_index }}` と記述する。このオブジェクトを含まないとセクションがホームページに表示されない。
注意点
Liquid インデックステンプレート(`templates/index.liquid`)でのみ使用可能で、JSON インデックステンプレート(`templates/index.json`)では機能しない。Online Store 2.0 以降の推奨構成は JSON テンプレート + セクション API のため、新規テーマは `index.json` の使用を検討する。
タグ:home-pagesectiontemplateindex

仕様

27 行 / json
{
  "access": {
    "global": true,
    "parents": [],
    "template": []
  },
  "deprecated": false,
  "deprecation_reason": "",
  "description": "If you use a [Liquid index template](/themes/architecture/templates/index-template) (`templates/index.liquid`), then you must include `{{ content_for_index }}` in the template. This object can't be used in JSON index templates.",
  "properties": [],
  "summary": "Dynamically returns the content of [sections](/themes/architecture/sections) to be rendered on the home page.",
  "name": "content_for_index",
  "examples": [],
  "json_data": {
    "path": "",
    "handle": "",
    "data_from_file": ""
  },
  "return_type": [
    {
      "type": "string",
      "name": "",
      "description": "",
      "array_value": ""
    }
  ]
}

出典・ライセンス

License:
MIT

このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。

関連項目

📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_header オブジェクト

Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト中級

metaobjects オブジェクト

ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト初級

additional_checkout_buttons オブジェクト

PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

canonical_url オブジェクト

現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_additional_checkout_buttons オブジェクト

PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_layout オブジェクト

現在のテンプレートに応じた動的コンテンツをレイアウトファイルに埋め込む。theme.liquid の `<body>` 内で使用し、ページごとに異なる HTML を自動的に挿入する。

📁 theme-liquid-docs·MIT·27