Objects

Liquid Page Object

Using Page Object

Liquid page object accesses Shopify page content and titles.

Understanding the Liquid Page Object

The Liquid Page Object in Shopify is a powerful tool that allows developers to access the content and titles of pages within a Shopify store. This object is particularly useful when you want to fetch the details of static pages, such as an 'About Us' page or any other custom page created through the Shopify admin panel.

Accessing Page Attributes

The Page Object provides several attributes that can be accessed directly in Liquid templates. These attributes include:

  • title: The title of the page.
  • content: The main content of the page, including any HTML.
  • handle: A unique identifier for the page, useful for linking.
  • url: The full URL of the page.

Example: Displaying a Page Title and Content

To display the title and content of a specific page in a Shopify theme, you can use the following Liquid code:

Using the Page Handle

The handle of a page is a unique identifier that can be used to access specific pages. This is particularly useful when you want to link to a page or fetch its details dynamically. Here's an example of how you might use a page handle in a link:

Fetching a List of Pages

Shopify provides a way to fetch a collection of pages, but it's important to note that this must be done through a workaround since Shopify's Liquid does not natively support loops over all pages. You can, however, utilize tags or collections to create such lists.

Previous
Shop Object