📘 公式リファレンス🔧 リファレンス/フィルター初級
asset_img_url フィルター(テーマアセット画像の CDN URL 取得)
テーマの assets フォルダに格納された画像ファイルの Shopify CDN URL を取得するフィルター。デフォルトでは small サイズ(100×100 px)を返し、size パラメータで他のサイズに変更できる。
用途
テーマに同梱したロゴ・アイコン・バナー画像を Liquid テンプレート内で参照するとき。特にヘッダーやフッターで固定画像を CDN 経由で読み込む場合に使用する。
設置場所
Liquid テンプレート内で `{{ 'ファイル名.jpg' | asset_img_url }}` または `{{ 'ファイル名.jpg' | asset_img_url: 'large' }}` の形で使い、img タグの src に設定する。
注意点
デフォルトサイズは small(100×100 px)であり、明示的にサイズを指定しない限り自動で縮小される。theme.liquid や section ファイル内で使う場合、ファイル名は assets フォルダ内に実際に存在することが前提。指定可能なサイズは img_url フィルターの size パラメータ仕様に準拠する。
仕様
50 行 / json{
"category": "hosted_file",
"deprecated": false,
"deprecation_reason": "",
"description": "",
"parameters": [
{
"description": "The desired image size.",
"name": "size",
"positional": true,
"required": false,
"types": [
"string"
]
}
],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"examples": [
{
"name": "",
"description": "",
"syntax": "",
"path": "/",
"raw_liquid": "{{ 'red-and-black-bramble-berries.jpg' | asset_img_url }}",
"parameter": false,
"display_type": "text",
"show_data_tab": true
},
{
"name": "size",
"description": "By default, the `asset_img_url` filter returns the `small` version of the image (100 x 100 px). However, you can specify a [size](/docs/api/liquid/filters/img_url#img_url-size).\n",
"syntax": "image | asset_img_url: string",
"path": "/",
"raw_liquid": "{{ 'red-and-black-bramble-berries.jpg' | asset_img_url: 'large' }}",
"parameter": true,
"display_type": "text",
"show_data_tab": true
}
],
"summary": "Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for an image in the\n[`assets` directory](/themes/architecture#assets) of a theme.",
"syntax": "string | asset_img_url",
"name": "asset_img_url"
}出典・ライセンス
- 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 行