Filter-Url

Filter Url

url

  • image_tag
  • image_url
  • base_url_a_with_void
  • base_url
  • product_url
  • collection_url
  • review_url
  • page_url
  • blog_collection_url
  • blog_article_url
  • search_url
  • coupon_url
  • checkout_url
  • customer_order_url
  • account_url
  • pay_success_url
  • public_url

image_tag

image_tag 用于生成 HTML <img> 标签,支持常用属性设置

支持的参数

属性 类型 默认值 描述
alt string '' 图片替代文本,支持多语言处理。
width int null 图片显示宽度。
height int null 图片显示高度。
class string '' 自定义 CSS 类名。
loading string 'lazy' 图片加载策略,可选 'lazy''eager' 等。
fetchpriority string null 图片加载优先级,如 'high'
//1.数据:
{
  "image": {
    "src": "https://example.com/image.jpg",
    "alt": "示例图片",
    "image_data": {
      "width": 600,
      "height": 400
    }
  },
  "loading": "lazy",
  "fetchpriority": "high"
}


// 2.代码:
{{
      image.src
      | image_tag:
        loading: loading,
        fetchpriority: fetchpriority,
        class: 'f-image-comparison__image-desktop',
        width: image.image_data.width,
        height: image.image_data.height,
        alt: image.alt
    }}

// 3.输出
<img src="https://example.com/image.jpg?width=600&height=400&scale=2" 
     alt="示例图片" 
     width="600" 
     height="400" 
     class="f-image-comparison__image-desktop" 
     loading="lazy" 
     fetchpriority="high" />

image_url

通过图片的path,得到完整的图片url

  • 如果是http开头的完整url,将直接返回
//1.数据:
{
  "image": {
    "src": "/diy/15/image/2025/08/05/a040d640eac182da4a38c5e27f0f246d.webp"
  },
  "image2": {
    "src": "https://example.com/image.jpg?width=600&height=400&scale=2"
  }
}


// 2.代码:
{{ image.src | image_url }}
{{ image2.src | image_url }}


// 3.输出
https://cdn12.myfecify.com/diy/15/image/2025/08/05/a040d640eac182da4a38c5e27f0f246d.webp
https://example.com/image.jpg?width=600&height=400&scale=2

base_url

通过urlkey,得到url

  • 如果url是http开头,那么将直接返回
  • 如果是字符串,那么在前面加上店铺域名,如果是多语言店铺,那么加上语言后缀
  • 如果是对象,那么从子项key:url_value,进行取值
  • 支持传递url参数
// 1.数据
{
  button_link:"/collections/all",
  button_link2: {
    "url_value":"/collections",
  }
}


// 2.代码
{{ button_link | base_url: k1:'v1', K2:'v2' }}
{{ button_link2 | base_url }}
{{ "https://www.fecshop.cn/product/dress" | base_url }}


// 3.输出
https://www.fecshop.cn/collections/all?k1=v1&k2=v2
https://www.fecshop.cn/collections
https://www.fecshop.cn/product/dress

2.多语言:如果当前语言是es(非默认语言),那么将加上es后缀,输出

https://www.fecshop.cn/es/collections/all

base_url_a_with_void

base_url_a_with_void主要是给加上链接

  • 当链接为空,则返回:javascript:void()

和base_url逻辑大致相同,唯一不同的地方是:

  • 当不符合逻辑,或者参数为空,base_url返回的是空字符串
  • 当不符合逻辑,或者参数为空,base_url返回的是javascript:void()
// 1.数据
{
  button_link:"/collections/all",
  button_link2: ""
}


// 2.代码
{{ button_link | base_url_a_with_void }}
{{ button_link2 | base_url_a_with_void }}
{{ "https://www.fecshop.cn/product/dress" | base_url_a_with_void }}


// 3.输出
https://www.fecshop.cn/collections/all
javascript:void()
https://www.fecshop.cn/product/dress

product_url

通过传递商品的handle值,返回商品的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "product": {
    "handle":"summer-dress"
  },
  "http_url":"http://www.example.com/products/xxxxx"
}


// 2.代码
{{ product.handle | product_url: k1:'v1', K2:'v2' }}
{{ product.http_url | product_url }}


// 3.输出
https://www.fecshop.cn/products/summer-dress?k1=v1&k2=v2
http://www.example.com/products/xxxxx

collection_url

通过传递商品专辑的handle值,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "collection": {
    "handle":"summer-dress"
  },
  "http_url":"http://www.example.com/collections/xxxxx"
}


// 2.代码
{{ collection.handle | collection_url: k1:'v1', K2:'v2' }}
{{ collection.http_url | collection_url }}


// 3.输出
https://www.fecshop.cn/collections/summer-dress?k1=v1&k2=v2
http://www.example.com/collections/xxxxx

review_url

通过传递商品评论汇总页面的handle值,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "review": {
    "handle":"1"
  },
  "http_url":"http://www.example.com/review/xxxxx"
}


// 2.代码
{{ review.handle | review_url: k1:'v1', K2:'v2' }}
{{ review.http_url | review_url }}


// 3.输出
https://www.fecshop.cn/review/1?k1=v1&k2=v2
http://www.example.com/review/xxxxx

page_url

通过传递自定义页面(page)的handle值,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "pages": {
    "handle":"summer-dress"
  },
  "http_url":"http://www.example.com/pages/xxxxx"
}


// 2.代码
{{ pages.handle | page_url: k1:'v1', K2:'v2' }}
{{ pages.http_url | page_url }}


// 3.输出
https://www.fecshop.cn/pages/summer-dress?k1=v1&k2=v2
http://www.example.com/pages/xxxxx

blog_collection_url

通过传递博客专辑的handle值,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "blogs": {
    "handle":"summer-dress"
  },
  "http_url":"http://www.example.com/blogs/xxxxx"
}


// 2.代码
{{ blogs.handle | blog_collection_url: k1:'v1', K2:'v2' }}
{{ blogs.http_url | blog_collection_url }}


// 3.输出
https://www.fecshop.cn/blogs/summer-dress?k1=v1&k2=v2
http://www.example.com/blogs/xxxxx

blog_article_url

通过传递博客文章的handle值,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "blog": {
    "handle":"summer-dress"
  },
  "http_url":"http://www.example.com/blog/xxxxx"
}


// 2.代码
{{ blog.handle | blog_article_url: k1:'v1', K2:'v2' }}
{{ blog.http_url | blog_article_url }}


// 3.输出
https://www.fecshop.cn/blog/summer-dress?k1=v1&k2=v2
http://www.example.com/blog/xxxxx

search_url

通过传递搜索的文字字符串,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "search": {
    "text":"summer dress"
  },
  "http_url":"http://www.example.com/search?q=dress&page=1"
}


// 2.代码
{{ search.text | search_url: k1:'v1', K2:'v2' }}
{{ search.http_url | search_url }}


// 3.输出
https://www.fecshop.cn/search?q=summer%20dress&k1=v1&k2=v2
http://www.example.com/search?q=dress&page=1

coupon_url

通过传递优惠券的handle值,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "coupon": {
    "discount_key":"1"
  },
  "http_url":"http://www.example.com/coupon/xxxxx"
}


// 2.代码
{{ coupon.discount_key | coupon_url: k1:'v1', K2:'v2' }}
{{ coupon.http_url | coupon_url }}


// 3.输出
https://www.fecshop.cn/coupon/1?k1=v1&k2=v2
http://www.example.com/coupon/xxxxx

checkout_url

通过传递订单编号字符串,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "order": {
    "number":"D908293907445434"
  },
  "http_url":"https://www.fecshop.cn/checkout/xxxxxxx?step=contact_information"
}


// 2.代码
{{ order.number | checkout_url: k1:'v1', K2:'v2' }}
{{ order.http_url | checkout_url }}


// 3.输出
https://www.fecshop.cn/checkout/D908293907445434?k1=v1&k2=v2
https://www.fecshop.cn/checkout/xxxxxxx?step=contact_information

customer_order_url

账号中心,订单详细页面,返回该页面的url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "order": {
    "number":"D908294669386166"
  },
  "http_url":"https://www.fecshop.cn/customer_order/D908294669386166"
}


// 2.代码
{{ order.number | customer_order_url: k1:'v1', K2:'v2' }}
{{ order.http_url | customer_order_url }}


// 3.输出
https://www.fecshop.cn/customer_order/D908294669386166?k1=v1&k2=v2
https://www.fecshop.cn/customer_order/D908294669386166

account_url

账号中心,得到页面的url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "account_address":"addresses",
  "account_inquire":"b2c-inquire",
  "account_order":"order"
}


// 2.代码
{{ account_address | customer_order_url }}
{{ account_inquire | customer_order_url }}
{{ account_order | customer_order_url }}


// 3.输出
https://www.fecshop.cn/account/addresses
https://www.fecshop.cn/account/b2c-inquire
https://www.fecshop.cn/account/order

pay_success_url

通过传递订单编号字符串,返回专辑的完整url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么完整url中将加入语言后缀
  • 支持传递url参数
// 1.数据
{
  "order": {
    "number":"D908294669386166"
  },
  "http_url":"https://www.fecshop.cn/pay_success/D908294669386166"
}


// 2.代码
{{ order.number | pay_success_url: k1:'v1', K2:'v2' }}
{{ order.http_url | pay_success_url }}


// 3.输出
https://www.fecshop.cn/pay_success/D908294669386166?k1=v1&k2=v2
https://www.fecshop.cn/pay_success/D908294669386166

public_url

通过传递任意的url path,得到相应的url

  • 如果参数是http开头,则直接返回
  • 如果是多语言,那么将不带语言后缀,这个也是和base_url的区别
  • 支持传递url参数
// 1.数据
{
  logo:"/xxx/xxx/xxx.jpg",
}


// 2.代码
{{ logo | public_url: k1:'v1', K2:'v2' }}


// 3.输出
https://www.fecshop.cn/xxx/xxx/xxx.jpg?k1=v1&k2=v2
Copyright © fecify.com 2025 all right reserved,powered by Gitbook该文件修订时间: 2025-09-09 11:23:41

results matching ""

    No results matching ""