URL Filters

URL filters is a collection of filters that help with managing URLs in the theme.


build_query

Merges given query to current query.

Input

 {{ product | link | build_query: "width=32&height=45" }}

Output

 https://www.mystore.com/products/my-product?width=32&height=45

img_url

Get the URL for object image.

Input

 {{ product | img_url }}

Output

 https://cdn.finqu.com/users/12345/images/product/image.png

link_to

Shorthand for creating a anchor element.

Input

 {{ "Start your trial now!" | link_to: "https://finqu.com" }}
 {{ "Start your trial now!" | link_to: "https://finqu.com", "Visit finqu.com", "_blan" }}

Output

 <a href="https://finqu.com">Start your trial now!</a>
 <a href="https://finqu.com" title="Visit finqu.com" target="_blank">Start your trial now!</a>

thumb

Creates a thumbnail from given image. Supports only images that are hosted by Finqu or Unsplash. You set a custom size with a parameter or select one from predefined size constants.

Constant Size
pico 16x16
icon 32x32
thumb 50x50
small 100x100
compact 160x160
medium 240x240
large 480x480

Input

 {{ product.image | thumb:'icon' }}
 {{ product.image | thumb:'240','400' }}
 {{ product.image | thumb:'240, 400' }}

Output

 https://cdn.finqu.com/users/12345/images/product/image_32_32.png
 https://cdn.finqu.com/users/12345/images/product/image_240_400.png
 https://cdn.finqu.com/users/12345/images/product/image_240_400.png

url_decode

Decodes a string that has been encoded as a URL.

Input

 {{ "%27Stop%21%27+said+Fred" | url_decode }}

Output

 'Stop!' said Fred

url_encode

Converts any URL-unsafe characters in a string into percent-encoded characters.

Input

 {{ "john@liquid.com" | url_encode }}

Output

 john%40liquid.com