Link
The link
object cannot be invoked on its own. It must be invoked inside a linklist.
The link
object has the following attributes:
In this article
link.active
Returns true
if the link is active, or false
if the link is inactive.
If you are on a product page that is collection-aware, link.active
will return true
for both the collection-aware product URL and the collection-agnostic URL. For example, if you have a link whose URL points to:
/products/haravan-product
link.active
will return true
for the following URL, which links to the same product but through a collection:
/collections/haravan-collection/products/haravan-product
If you are on a collection page filtered with tags, and the link points to the unfiltered collection page, link.active
will return true
.
If you are on an article page and your link points to the blog, link.active
will return true
.
link.object
Returns the variable associated to the link. The possible types are:
- product
- collection
- page
- blog
Through link.object
, you can access any of the attributes that are available in the above three variables.
Input
If the product links to a product with a price of 100.000đ
{{ link.object.price | money }}
Output
100.000đ
link.title
Returns the title of the link.
link.type
Returns the type of the link. The possible values are:
- collection_link: if the link points to a collection
- product_link: if the link points to a product page
- page_link: if the link points to a page
- blog_link: if the link points to a blog
- relative_link: if the link points to the search page, the home page or /collections/all
- http_link: if the link points to an external web page, or a type or vendor collection (ex: /collections/types?q=Pants)
link.url
Returns the URL of the link.