3.1 KiB
layout, title, nav
| layout | title | nav | ||
|---|---|---|---|---|
| default | link |
|
link
The link object cannot be invoked on its own. It must be invoked inside a linklist.
The link object has the following attributes:
{% anchor_link "link.active", "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.activewill 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:
link.active will return true for the following URL, which links to the same product but through a collection:
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.
{% anchor_link "link.object", "link-object" %}
Returns the variable associated to the link. The type of variable that is returned is dependent on the value of Links To field of the link. The possible types are:
Through link.object, you can access any of the attributes that are available in the above three variables.
Input
Output
{% anchor_link "link.title", "link-title" %}
Returns the title of the link.
{% anchor_link "link.type", "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)
{% anchor_link "link.url", "link-url" %}
Returns the URL of the link.