📘 公式リファレンス🔧 リファレンス/フィルター初級
default_pagination フィルター(ページネーションリンクを自動生成)
paginate オブジェクトに対して、前後ページへのリンク HTML を自動生成するフィルター。ページ送りのテキストやアンカーをカスタマイズできる。
用途
コレクションページや検索結果で、商品を複数ページに分割表示するときにページネーションを出す。前へ・次へのリンクテキストを日本語に変更したい場合にもこのフィルターを使う。
設置場所
paginate タグで囲んだ商品ループの終わりに `{{ paginate | default_pagination }}` で記述する。通常は templates/collection.liquid や templates/search.liquid などのコレクション系テンプレートで使用する。
注意点
paginate タグ内でのみ有効で、paginate タグの外で使うと空文字になる。前後のテキストを日本語にする場合は `previous: '前へ'` `next: '次へ'` パラメータを指定する。anchor パラメータで div id を指定することで、ページ遷移時にその要素にジャンプさせることができる。
仕様
88 行 / json{
"category": "default",
"deprecated": false,
"deprecation_reason": "",
"description": "",
"parameters": [
{
"description": "The text for the previous page link.",
"name": "previous",
"positional": false,
"required": false,
"types": [
"string"
]
},
{
"description": "The text for the next page link.",
"name": "next",
"positional": false,
"required": false,
"types": [
"string"
]
},
{
"description": "The anchor to add to the pagination links.",
"name": "anchor",
"positional": false,
"required": false,
"types": [
"string"
]
}
],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"examples": [
{
"name": "",
"description": "",
"syntax": "",
"path": "/collections/sale-potions",
"raw_liquid": "{% paginate collection.products by 2 %}\n {% for product in collection.products %}\n {{- product.title }}\n {% endfor %}\n\n {{- paginate | default_pagination -}}\n{% endpaginate %}",
"parameter": false,
"display_type": "text",
"show_data_tab": true
},
{
"name": "previous",
"description": "Specify the text for the previous page link.",
"syntax": "paginate | default_pagination: previous: string",
"path": "/collections/sale-potions",
"raw_liquid": "{% paginate collection.products by 2 %}\n {% for product in collection.products %}\n {{- product.title }}\n {% endfor %}\n\n {{- paginate | default_pagination: previous: 'Previous' -}}\n{% endpaginate %}",
"parameter": true,
"display_type": "text",
"show_data_tab": false
},
{
"name": "next",
"description": "Specify the text for the next page link.",
"syntax": "paginate | default_pagination: next: string",
"path": "/collections/sale-potions",
"raw_liquid": "{% paginate collection.products by 2 %}\n {% for product in collection.products %}\n {{- product.title }}\n {% endfor %}\n\n {{- paginate | default_pagination: next: 'Next' -}}\n{% endpaginate %}",
"parameter": true,
"display_type": "text",
"show_data_tab": false
},
{
"name": "anchor",
"description": "Specify the anchor to add to the pagination links.",
"syntax": "paginate | default_pagination: anchor: string",
"path": "/collections/sale-potions",
"raw_liquid": "{% paginate collection.products by 2 %}\n {% for product in collection.products %}\n {{- product.title }}\n {% endfor %}\n\n <div id=\"pagination\">\n {{- paginate | default_pagination: anchor: 'pagination' -}}\n </div>\n{% endpaginate %}",
"parameter": true,
"display_type": "text",
"show_data_tab": false
}
],
"summary": "Generates HTML for a set of links for paginated results. Must be applied to the [`paginate` object](/docs/api/liquid/objects/paginate).",
"syntax": "paginate | default_pagination",
"name": "default_pagination"
}出典・ライセンス
- Repository:
- https://github.com/Shopify/theme-liquid-docs
- License:
- MIT
このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。
関連項目
📘 公式リファレンス🔧 リファレンス/フィルター初級
avatar フィルター(顧客アバター画像HTML生成)
顧客アバターが存在する場合、それを表示する HTML タグを生成するフィルター。customer オブジェクトに対して使用する。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
default_errors フィルター(フォーム送信エラーを日本語化)
form.errors の各エラーコードに対応する既定のエラーメッセージを自動生成するフィルター。フォーム送信時の入力値不正や必須項目空白などのエラーを言語別に出力する。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
date フィルター(日付を指定形式でフォーマット)
日付値を指定されたフォーマット文字列に従って整形する。フォーマット文字列が空の場合は元の値がそのまま返される。入力が日付に変換できない場合も元の値が返される。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
payment_terms フィルター(Shop Pay分割払いバナーを生成)
product フォームまたは cart フォームに対して使用し、Shop Pay の分割払いオプションを表示するための HTML を生成するフィルター。顧客が購入時に分割払いプランを選択できるようにする。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
abs フィルター(数値の絶対値を取得)
負の数を正の数に変換する。数値の絶対値(ゼロからの距離)を返すフィルター。
📁 theme-liquid-docs·MIT·30 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
append フィルター(文字列の末尾に追加)
文字列の末尾に別の文字列を連結するフィルター。URL パスの結合やテキストの接尾辞追加に使う。
📁 theme-liquid-docs·MIT·30 行