Page
This object represents a page. On every page view, there exists a property named page which provides access to properties of the current page (or the parent page in case of article and element pages).
List of available attributes
- blog?
- content_type
- created_at
- created_at
- data
- description
- elements_page?
- full_title
- hidden?
- image?
- image
- keywords
- language_code
- language_id
- language_locale
- language_region
- layout_title
- level
- link?
- menu_title
- menuitem
- new_record?
- node_id
- og_image?
- og_image
- page_id
- parent
- path_with_lang
- path
- persisted?
- private?
- site_title
- title_format
- title_separator_value
- title_separator
- title
- to_json
- updated_at
- url
blog?
Returns true if page is a blog.
data
Returns custom data bound to page.
elements_page?
Returns true if page is an elements page.
persisted?
Returns true if the page is saved.
private?
Returns true if page is protected with password.
content_type
Returns the content type for the current page – one of "page", "blog", "blog_article", "elements", "element", "product", "error_401", "error_404" or "link".
created_at
Returns a date when this page was first created. Use date formatting filter to format the date.
description
Page description information.
hidden?
Returns true if page is hidden from site menu.
id, page_id
Returns the ID of the page.
image
Returns the image that can has been attached to the page in its settings.
image?
Returns true or false depending whether image is attached to page.
og_image
Alias for image.
og_image?
Alias for image?.
keywords
Page keywords information. Site keywords are added to page unique keywords.
language_id
Page language ID.
language_code
A 2-character language code for the given page, e.g. 'en' for English, 'ru' for Russian, 'et' for Estonian.
language_region
A 2-character region code for languages that support regions. E.g. "GB" or "BR". Otherwise nil.
language_locale
Equivalent to the output of language_code
for region-less
languages. If a language supports regions, this is a concatenation of
the language code, an underscore and the region code, e.g. "en_GB".
layout_title
Returns the name of the page's layout.
level
Page level of location in site tree.
link?
Returns true if the page is actually an external link.
menuitem
Returns the menu item for the current page.
new_record?
Returns true if the page hasn't been saved yet.
node_id
Page node ID.
path
Returns path for given page.
<a href="{{ page.path }}">{{ page.title }}</a>
#=> <a href="current/page/path">Current page</a>
Please notice that this is a relative path for this page. We suggest you always use absolute paths on your site, which can be retrieved by url
(see below).
path_with_lang
Like path but adds language code for front page path for consistency of cross language links.
parent
Returns parent page of the current page or nothing in case of a top-level page.
Go <a href="{{ page.parent.url }}">up one level</a>
site_title
Returns the title for the site in the given language. Should be used when rendering the <title>
tag.
<html>
<head>
<title>{{ page.site_title }}</title>
</head>
...
</html>
title
Returns the page title.
<html><head><title>{{ page.title }}</title></head>...</html>
#=> <html><head><title>Current page</title></head>...</html>
full_title
Returns page full title for <title>
tag value. It's created by page title and site title using page title_separator and title_format with fallback to defaults (site or system default values).
<html><head><title>{{ page.full_title }}</title></head>...</html>
=> <html><head><title>Current page – My site</title></head>...</html>
menu_title
Returns page title in menu. When not set then defaults to title.
title_separator
Returns page <title>
tag separator override value used by full_title. When empty then site (or system default) value is used instead.
title_separator_value
Returns <title>
tag separator value for page with fallback to defaults (site or system default ("–") values). It's used by full_title.
title_format
Returns page <title>
tag format override value used by full_title. When empty then site (or system default) value is used instead.
Supported values and their corresponding patterns:
page_site
–<page_title> <separator> <site_title>
site_page
–<site_title> <separator> <page_title>
page
–<page_title>
site
–<site_title>
title_format_pattern
Returns <title>
tag format patten for page with fallback to defaults (site or system default (<page_title> <separator> <site_title>
) values). It's used by full_title.
url
Returns the page's URL.
<a href="{{ page.url }}">{{ page.title }}</a>
#=> <a href="/site_prefix/current/page/path">Current page</a>
created_at
Returns a date when this page was first created. Use date formatting filter to format the date.
updated_at
Returns a date when this page was last updated. Useful for showing "last updated" timestamps. Use date formatting filter to format the date.
This page was last updated at <b>{{ page.updated_at | date : "%d.%m.%Y" }}</b> #=> This page was last updated at <b>09.11.2023</b>
to_json
Serializes the page into a JSON string.