DevHub Docs
Search
K

Template variables

pages

This utility allows you to access and filter the current Pages within a Site.

Output all pages

<ul>
{% for p in pages %}
<li>{{ p.full_path }}</li>
{% endfor %}
</ul>

Filtering pages

Example of filtering pages by template page type
<ul>
{% for p in pages.filter({'custom_page_type': 'promotions'}) %}
<li>{{ p.full_path }}</li>
{% endfor %}
</ul>

Ordering pages

{{ pages.filter({}, order_by='path' }}

Accessing custom fields

{% for page in pages %}
{{ page.custom_fields.some_value }}
{% endif %}

Get a single page

{% set home_page = pages.get_one({'path': '/'}) %}

Available page fields

Standard page fields used in templates
Property
Text
Example
name
Name of the current page
Home
full_path
Full page path which should be used for HTML links. If under a sub-directory, this path will contain the base_directory of the Local site/page
/local-page/about-us/
path
Page path set within the Site Builder. Good for looking up a particular page using filter or get_one
/about-us/
custom_page_type
Template page type
page_type_example
is_published
Boolean value if the page is currently published
True
custom_fields
Array of custom field values. Access via custom_fields.value_name