---
title: 'Liquid objects: url'
description: >-
  A URL object from a [`url`
  setting](/themes/architecture/settings/input-settings#url) or a `url`
  [metafield](/docs/api/liquid/objects/metafield).
source_url:
  html: 'https://shopify.dev/docs/api/liquid/objects/url'
  md: 'https://shopify.dev/docs/api/liquid/objects/url.md'
api_name: liquid
---

# url

A URL object from a [`url` setting](https://shopify.dev/themes/architecture/settings/input-settings#url) or a `url` [metafield](https://shopify.dev/docs/api/liquid/objects/metafield).

When URLs are saved as references to Shopify resources, they return dedicated [`object` drops](https://shopify.dev/docs/api/liquid/objects/url#url-object).

When the `url` object is referenced directly in a theme file, the [`url` string](https://shopify.dev/docs/api/liquid/objects/url#url-url) is returned.

## Properties

* * **object**

  * The resource that the URL points to.

    The object can be one of the following:

    * [`article`](https://shopify.dev/docs/api/liquid/objects/article)
    * [`blog`](https://shopify.dev/docs/api/liquid/objects/blog)
    * [`collection`](https://shopify.dev/docs/api/liquid/objects/collection)
    * [`metaobject`](https://shopify.dev/docs/api/liquid/objects/metaobject)
    * [`page`](https://shopify.dev/docs/api/liquid/objects/page)
    * [`policy`](https://shopify.dev/docs/api/liquid/objects/policy)
    * [`product`](https://shopify.dev/docs/api/liquid/objects/product)
    * A [string](https://shopify.dev/docs/api/liquid/basics#string) that contains the URL, if the [`type`](https://shopify.dev/docs/api/liquid/objects/url#url-type) is `external_link`

    For any other type, or if the resource no longer exists, `nil` is returned. A path that's entered as text, such as `/products/walrus-socks`, is a `relative_link`, so its `object` is `nil` even if the path matches a resource.

  * **type**

    [string](https://shopify.dev/docs/api/liquid/basics#string) from a set of values

  * 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 `product_link` or `catalog_link`.
    * A path that's entered as text, such as `/products/walrus-socks`, returns `relative_link`, even if the path matches a resource. The only exception is `/`, which returns `home_link`.
    * A path from a dynamic source, such as `{{ page.url }}`, also returns `relative_link`.
    * An absolute URL returns `external_link`, 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](https://help.shopify.com/manual/online-store/themes/customizing-themes/change-catalog-page) (`/collections/all`). |
    | collection\_link | The URL points to a collection. |
    | collections\_link | The URL points to the [collection list page](https://shopify.dev/themes/architecture/templates/list-collections) (`/collections`). |
    | external\_link | The URL is an absolute URL that starts with `http`, `https`, `mailto`, or `tel`. |
    | 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](https://help.shopify.com/manual/online-store/themes/theme-structure/pages). |
    | policy\_link | The URL points to a [policy page](https://help.shopify.com/manual/checkout-settings/refund-privacy-tos#add-links-to-your-policies-within-pages-or-on-social-media). |
    | 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 `/pages/about`. |

  * **url**

    [string](https://shopify.dev/docs/api/liquid/basics#string)

  * The URL.

    The URL string to be used as the `href` in links. This is the same value that's returned when the `url` object 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 `/fr/collections/spring`. Relative paths and anchors are returned exactly as they were entered.
