📘 公式リファレンス📦 リファレンス/オブジェクト初級
blog オブジェクト
ブログの ID、タイトル、記事一覧、メタフィールド、コメント設定など、ブログ全体の情報にアクセスするオブジェクト。
用途
ブログテンプレートや記事テンプレートで、ブログの基本情報を表示したり、ブログ内のすべての記事やタグを一覧表示したりするとき。
設置場所
templates/blog.liquid または templates/article.liquid 内で `{{ blog.title }}`、`{{ blog.articles }}`、`{{ blog.all_tags }}` などの形で参照する。
注意点
articles プロパティは paginate タグで1ページあたり最大50件まで指定できる。all_tags はブログ全体のタグを返すが、tags はフィルタビューに限定されたタグのみを返す。comments_enabled? は true を返してもコメント投稿の仕様がブログの設定に依存するため、別途管理画面で確認する。template_suffix はカスタムテンプレートが割り当てられていない場合は nil を返す。
仕様
248 行 / json{
"access": {
"global": false,
"parents": [],
"template": [
"blog",
"article"
]
},
"deprecated": false,
"deprecation_reason": "",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The ID of the blog.",
"name": "id"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The title of the blog.",
"name": "title"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The [handle](/docs/api/liquid/basics#handles) of the blog.",
"name": "handle"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Tip:\n> Use the [paginate](/docs/api/liquid/tags/paginate) tag to choose how many articles to show per page, up to a limit of 50.",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "article"
}
],
"summary": "The articles in the blog.",
"name": "articles"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The total number of articles in the blog. This total doesn't include hidden articles.",
"name": "articles_count"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Tip:\n> To learn about how to create metafields, refer to [Create and manage metafields](/apps/metafields/manage) or visit\n> the [Shopify Help Center](https://help.shopify.com/manual/metafields).",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "metafield"
}
],
"summary": "The [metafields](/docs/api/liquid/objects/metafield) applied to the blog.",
"name": "metafields"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The relative URL of the blog.",
"name": "url"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The name doesn't include the `blog.` prefix, or the file extension (`.json` or `.liquid`).\n\n If a custom template isn't assigned to the blog, then `nil` is returned.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The name of the [custom template](/themes/architecture/templates#alternate-templates) assigned to the blog.",
"name": "template_suffix"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This includes tags of articles that aren't in the current pagination view.",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "string"
}
],
"summary": "All of the tags on the articles in the blog.",
"name": "all_tags"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "string"
}
],
"summary": "A list of all of the tags on all of the articles in the blog.\n\nUnlike [`blog.all_tags`](/docs/api/liquid/objects/blog#blog-all_tags), this property only returns tags of articles that are in the\nfiltered view.",
"name": "tags"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if comments are enabled for the blog. Returns `false` if not.",
"name": "comments_enabled?"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the blog is set to\n[moderate comments](https://help.shopify.com/manual/online-store/blogs/managing-comments). Returns `false` if not.",
"name": "moderated?"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "Returns `nil` if there is no next article.\n\nThis property can be used on the [article page](/themes/architecture/templates/article) to output `next` links.",
"examples": [],
"return_type": [
{
"type": "article",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The next (older) article in the blog.",
"name": "next_article"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "Returns `nil` if there is no previous article.\n\nThis property can be used on the [article page](/themes/architecture/templates/article) to output `previous` links.",
"examples": [],
"return_type": [
{
"type": "article",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The previous (newer) article in the blog.",
"name": "previous_article"
}
],
"summary": "Information about a specific [blog](https://help.shopify.com/manual/online-store/blogs/adding-a-blog) in the store.",
"name": "blog",
"examples": [],
"json_data": {
"path": "/blogs/potion-notions/new-potions-for-spring",
"handle": "blog",
"data_from_file": ""
},
"return_type": []
}出典・ライセンス
- Repository:
- https://github.com/Shopify/theme-liquid-docs
- 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_index オブジェクト
ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。
📁 theme-liquid-docs·MIT·27 行
📘 公式リファレンス📦 リファレンス/オブジェクト初級
content_for_additional_checkout_buttons オブジェクト
PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。
📁 theme-liquid-docs·MIT·27 行