📘 公式リファレンス📦 リファレンス/オブジェクト初級
comment オブジェクト
ブログ記事に投稿されたコメントを表すオブジェクト。コメント作成者の名前・メールアドレス、コメント本文、投稿日時などのプロパティを持つ。
用途
ブログ記事ページで公開済みコメント一覧を表示するとき。article.comments ループ内でコメントの著者名、本文、投稿日を個別に取得して表示する。
設置場所
blog-article.liquid テンプレート内の `{% for comment in article.comments %}` ループ内で `{{ comment.author }}`、`{{ comment.content }}`、`{{ comment.created_at | date: '%Y年%m月%d日' }}` のように参照する。
注意点
article.comments に含まれるのはステータスが published(公開済み)のコメントのみ。created_at と updated_at はタイムスタンプ文字列のため、日本語表記で整形する場合は date フィルターで成形する(例: `| date: '%Y年%m月%d日'`)。ブログコメント機能がストア側で有効化されていることが前提となる。
仕様
154 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "article",
"property": "comments"
}
],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The full name of the author of the comment.",
"name": "author"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The content of the comment.",
"name": "content"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Tip:\n> Use the [`date` filter](/docs/api/liquid/filters/date) to format the timestamp.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "A timestamp for when the comment was created.",
"name": "created_at"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The email of he author of the comment.",
"name": "email"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The ID of the comment.",
"name": "id"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "Outside of the Liquid context, the status of a comment can vary based on spam detection and whether blog comments are\nmoderated. However, only comments with a status of `published` are included in the [`article.comments` array](/docs/api/liquid/objects/article#article-comments).\n\n> Tip:\n> To learn more about blog comments, visit the [Shopify Help Center](https://help.shopify.com/manual/online-store/blogs/managing-comments).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The status of the comment. Always returns `published`.",
"name": "status"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Tip:\n> Use the [`date` filter](/docs/api/liquid/filters/date) to format the timestamp.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "A timestamp for when the status of the comment was last updated.",
"name": "updated_at"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The relative URL of the article that the comment is associated with, with [`comment.id`](/docs/api/liquid/objects/comment#comment-id)\nappended.",
"name": "url"
}
],
"summary": "An article comment.",
"name": "comment",
"examples": [],
"json_data": {
"path": "",
"handle": "",
"data_from_file": "{\"author\":\"Cornelius\",\"content\":\"Wow, this is going to save me a fortune in invisibility potion!\",\"created_at\":\"2022-06-05 19:33:57 -0400\",\"email\":\"cornelius.potionmaker@gmail.com\",\"id\":129089273921,\"status\":\"published\",\"updated_at\":\"2022-06-05 19:33:57 -0400\",\"url\":\"/blogs/potion-notions/how-to-tell-if-you-have-run-out-of-invisibility-potion#129089273921\"}"
},
"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 行