URL Filters
URL filters output links to assets. They are also used to create links for filtering collections and blogs.
- asset_url
- attachment_url
- link_to
- mail_to
- link_to_office
- link_to_home
- link_to_galleries
- link_to_people
- link_to_products
- link_to_services
- link_to_menu
- link_to_announcements
- link_to_brochures
- link_to_map
- link_to_about_us
- link_to_contact_us
- link_to_sign_in
- link_to_links
- link_to_videos
- link_to_attachments
- within
asset_url
Returns the URL of a file in the “assets” folder of a theme. You should prefix with your theme name.
Input
{{ 'sample/all.css' | asset_url }}
Output
http://s-iw-frontend-statics.s3.amazonaws.com/assets/sample/all-f9546da5db22e729f10b1aae62a16311.css
attachment_url
Returns the URL of an attachment. Accepts a size as a parameter. The attachment_url
filter can be used on any objects that have attachment(s). They have different attachment sizes. For example:
Input
{{ catalog_item | attachment_url: 'large' | image_tag }}
Output
<img src="http://s-yoolk-images1.yoolk.com/kh/catalog_item_images/large/1367097277/1250047?1367097277" />
link_to
Generate HTML anchor tag
{{ 'yoolk' | link_to: 'http://www.yoolk.com' }}
# => <a href="http://www.yoolk.com">yoolk</a>
mail_to
Creates a mailto link tag to the specified email_address, which is also used as the name of the link unless name is specified. Additional HTML attributes for the link can be passed in html_options.
{{ 'info@yoolk.com' | mail_to: 'Contact Information', alt: "alt of mail", title: "title of mail" }}
# => <a alt="alt of mail" href="mailto:info@yoolk.com" title="title of mail">Contact Information</a>
link_to_office
Generate HTML anchor tag for office path, optional options
is provided
{{ 'office' | link_to_office }}
# => <a href="/office">office</a>
{{ 'office' | link_to_office: class: "class_office", id: "id_office" }}
# => <a class="class_office" href="/office" id="id_office">office</a>
link_to_home
Generate HTML anchor tag for home path, optional options
is provided
{{ 'home' | link_to_home }}
# => <a href="/">home</a>
{{ 'home' | link_to_home: class: "class_home", id: "id_home" }}
# => <a class="class_home" href="/" id="id_home">home</a>
link_to_galleries
Generate HTML anchor tag for galleries path, optional options
is provided
{{ 'galleries' | link_to_galleries }}
# => <a href="/galleries">galleries</a>
{{ 'galleries' | link_to_galleries: class: "class_galleries", id: "id_galleries" }}
# => <a class="class_galleries" href="/galleries" id="id_galleries">galleries</a>
link_to_people
Generate HTML anchor tag for people path, optional options
is provided
{{ 'people' | link_to_people }}
# => <a href="/people">people</a>
{{ 'people' | link_to_people: class: "class_people", id: "id_people" }}
# => <a class="class_people" href="/people" id="id_people">people</a>
link_to_products
Generate HTML anchor tag for products path, optional options
is provided
{{ 'products' | link_to_products }}
# => <a href="/products">products</a>
{{ 'products' | link_to_products: class: "class_products", id: "id_products" }}
# => <a class="class_products" href="/products" id="id_products">products</a>
link_to_services
Generate HTML anchor tag for services path, optional options
is provided
{{ 'services' | link_to_services }}
# => <a href="/services">services</a>
{{ 'services' | link_to_services: class: "class_services", id: "id_services" }}
# => <a class="class_services" href="/services" id="id_services">services</a>
link_to_menu
Generate HTML anchor tag for menu path, optional options
is provided
{{ 'menu' | link_to_menu }}
# => <a href="/menu">menu</a>
{{ 'menu' | link_to_menu: class: "class_menu", id: "id_menu" }}
# => <a class="class_menu" href="/menu" id="id_menu">menu</a>
link_to_announcements
Generate HTML anchor tag for announcements path, optional options
is provided
{{ 'announcements' | link_to_announcements }}
# => <a href="/announcements">announcements</a>
{{ 'announcements' | link_to_announcements: class: "class_announcements", id: "id_announcements" }}
# => <a class="class_announcements" href="/announcements" id="id_announcements">announcements</a>
link_to_brochures
Generate HTML anchor tag for brochures path, optional options
is provided
{{ 'brochures' | link_to_brochures }}
# => <a href="/brochures">brochures</a>
{{ 'brochures' | link_to_brochures: class: "class_brochures", id: "id_brochures" }}
# => <a class="class_brochures" href="/brochures" id="id_brochures">brochures</a>
link_to_map
Generate HTML anchor tag for map path, optional options
is provided
{{ 'map' | link_to_map }}
# => <a href="/map">map</a>
{{ 'map' | link_to_map: class: "class_map", id: "id_map" }}
# => <a class="class_map" href="/map" id="id_map">map</a>
link_to_about_us
Generate HTML anchor tag for about us path, optional options
is provided
{{ 'about us' | link_to_about_us }}
# => <a href="/about_us">about us</a>
{{ 'about us' | link_to_about_us: class: "class_about_us", id: "id_about_us" }}
# => <a class="class_about_us" href="/about_us" id="id_about_us">about us</a>
link_to_contact_us
Generate HTML anchor tag for contact us path, optional options
is provided
{{ 'contact us' | link_to_contact_us }}
# => <a href="/contact_us">contact us</a>
{{ 'contact us' | link_to_contact_us: class: "class_contact_us", id: "id_contact_us" }}
# => <a class="class_contact_us" href="/contact_us" id="id_contact_us">contact us</a>
link_to_sign_in
Generate HTML anchor tag for sign in path.
{{ 'sign in' | link_to_sign_in }}
# => <a href="/office">sign in</a>
link_to_links
Generate HTML anchor tag for links path, optional options
is provided
{{ 'links' | link_to_links }}
# => <a href="/links">links</a>
{{ 'links' | link_to_links: class: "class_links", id: "id_links" }}
# => <a class="class_links" href="/links" id="id_links">links</a>
link_to_videos
Generate HTML anchor tag for videos path, optional options
is provided
{{ 'videos' | link_to_videos }}
# => <a href="/videos">videos</a>
{{ 'videos' | link_to_videos: class: "class_videos", id: "id_videos" }}
# => <a class="class_videos" href="/videos" id="id_videos">videos</a>
link_to_attachments
Generate HTML anchor tag for attachments path, optional options
is provided
{{ 'attachments' | link_to_attachments }}
# => <a href="/attachments">attachments</a>
{{ 'attachments' | link_to_attachments: class: "class_attachments", id: "id_attachments" }}
# => <a class="class_attachments" href="/attachments" id="id_attachments">attachments</a>
within
Product URL
Creates a product URL by prepending “/products-categories/product-category/” to a product URL, where “product_category” is the handle of the product category that is currently being viewed.
<a href="{{ product.url | within: product_category }}">{{ product.name }}</a>
# => <a href="products-categories/1161-cars/products/2183-defender">Defender</a>
Food URL
Creates a food URL by prepending “/menu-categories/food-category/” to a food URL, where “food_category” is the handle of the food category that is currently being viewed.
<a href="{{food.url | within: food_category}}">{{ food.name }}</a>
# => <a href="menu-categories/1161-cars/menu/2183-combo-plater">Combo Plater</a>