Page Content

Provides access to general information about a given page including link to edit or administrate, files and images on the page, whether it is hidden, etc.

Returns the page's contents.

Usage

{{ page.body }}

Returns the custom date associated with this page (can be changed in the page's settings).

Usage

{{ page.custom_date }}

Example

This page's custom date: {{ page.custom_date | date: "%B %e, %Y" }} 

Refer to the documentation on date formats.

Returns the page's description.

Usage

{{ page.description }}

Returns the embed code if the module is present on the page.

Usage

{{ page.embed_code }}

Example

<h3>Video</h3>
{{ page.embed_code }}

Returns a hash of files attached to the page.

Usage

{{ page.files }}

Example

{% for file in page.files %}
  {% if file.extension == 'mp3' %}
    <a href="{{ file.src }}" class="jquery-mp3-player">{{ file.title }}</a>
  {% endif %}
{% endfor %}

The attributes available for an individual file are

  • file.title, the title the file was given when uploaded;
  • file.filename, the actual name of the file;
  • file.extension, the file type;
  • file.src, the URL to the file.

Returns the page's ID.

Usage

{{ page.id }}

Example

<div id="page_{{ page.id }}">
  <!-- Your content here -->
</div>

Returns the page's name.

Usage

{{ page.name }}

Example

<h2>{{ page.name }}</h2>

Returns the URL to the current page.

Usage

{{ page.url }}

Returns the name of the page formatted for a URL.

Usage

{{ page.urlname }}

Returns true if the page is hidden from the navigation (can be changed in the page's settings).

Usage

{% if page.is_hidden? %}
  This page is hidden.
{% endif %}

Example

{% if page.is_hidden? %}
  <p>This page is hidden.</p>
{% endif %}

A page can have a single liquid page module attached to it. When you add the page module to a page, it will pull in all available liquid partials that you have in your template. On the design tab for your site, you can add more modules under the "page modules" tab.

All Modules

Returns an array of modules attached to the page.

Usage

{% if page.modules contains "blog" %}
  The page module called _blog.liquid is attached to this page!
{% endif %}

Example

{% if page.parent.modules contains "blog" %}
  Do something special just for blog posts.
{% endif %}

Returns true if the page has the embed code module.

Usage

{% if page.has_embed_code? %}
  The embed code is present.
{% endif %}

Example

{% if page.has_embed_code? %}
  {{ page.embed_code }}
{% endif %}