url
A URL object from a url setting or a url metafield.
When URLs are saved as references to Shopify resources, they return dedicated
object drops.
When the url object is referenced directly in a theme file, the url string
is returned.
Properties
- objectobject
The resource that the URL points to.
The object can be one of the following:
articleblogcollectionmetaobjectpagepolicyproduct- A string that contains the URL, if the
typeis
For any other type, or if the resource no longer exists,
nilis returned. A path that's entered as text, such as, is a, so itsobjectisnileven if the path matches a resource.The type of the URL.
The type depends on how the URL was set:
- A resource that's selected in the theme editor returns the type of that resource, such as
or. - A path that's entered as text, such as
, returns, even if the path matches a resource. The only exception is/, which returns. - A path from a dynamic source, such as
{{ page.url }}, also returns. - An absolute URL returns
, even if it points to the store.
Possible values Description anchor The URL points to an anchor on the current page, such as #faq.article_link The URL points to an article. blog_link The URL points to a blog. catalog_link The URL points to the catalog page ( ).collection_link The URL points to a collection. collections_link The URL points to the collection list page ( /collections).external_link The URL is an absolute URL that starts with http,https,mailto, ortel.home_link The URL is the home page path ( /).metaobject_link The URL points to a metaobject page. page_link The URL points to a page. policy_link The URL points to a policy page. product_link The URL points to a product page. relative_link The URL is a path that was entered as text or comes from a dynamic source, such as .- A resource that's selected in the theme editor returns the type of that resource, such as
The URL.
The URL string to be used as the
hrefin links. This is the same value that's returned when theurlobject is referenced directly.URLs that point to store resources, the home page, and the collection pages include the path prefix of the current locale, such as
. Relative paths and anchors are returned exactly as they were entered.