Liqiud basics
Modules
API
Mailer
Pages
On this page
Overview
Below you can see all the available drops on the page object
| Name | Description |
| page.id | Unique id |
| page.url | Page URL |
| page.title | Title for page |
| page.root | Returns root page drop OBS! Verkar inte funka |
| page.link_page | Boolean. If the "Link page" option is checked in page settings |
| page.published? | Boolean. If the "Published" option is checked in page settings |
| page.created_at | Timestamp when the page was created (YYYY-MM-DD HH:MM:SS +GMT) |
| page.updated_at | Timestamp when the page was last updated (YYYY-MM-DD HH:MM:SS +GMT) |
| page.protected? | Boolean. If the "Protected" option is checked under "Extranet" in page settings. This is only available if your site uses the Extranet module. |
| page.visible_menu? | Boolean. If the "Visible menu link" option is checked in page settings |
| page.root_page | Returns root of the page in a Pagedrop. Must be used with an additional drop, e.g. page.root_page.title. |
| page.parent_page | Get the parent of the page drop. If a parent don't exists it will return nil |
| page.children | Returns an array with page children |
| page.ancestors | Returns an array with page ancestors |
| page.ancestor_ids | Returns a list of ancestor ids, starting with the root id and ending with the parent id |
| page.tags | Return the page tags |
| page.excerpt | Get the page excerpt (raw text) |
| page.published_editables | Get published editables content |
| page.saved_editables | Get saved editables content |
| page.content_updated_at | Get saved editables content |
| page.target_page | If this page is a link page and points to another page in the current site, it returns it |
| page.seo | Returns an seo drop for this page |
| page.og_image | Open Graph image property |
| page.og_title | Open Graph title property |
| page.og_description | Open Graph description property |
Tags
Use a loop to get all the tags belonging to that page. You can find all of the available properties you can get from the tag object.
{% for tag in page.tags %}
{{ tag.name }}
{% endfor %}
Editables
On a page you can use page_editable and global_editable. Each editable needs to have an id which is defined inside ' ' so for example 'main'.
Page_editable
A page_editable is an editable that is specific to that page, and that page only. The content inside that editable will only be available on that specific page. Page editables will get a blue border in the live editing tool.
So if you were to create an editable with the id main in your template, each page that is using that template will have it's own instance of the editable. In other words: The editable will only be saved to that page and will not interfear with content on other pages that uses the main page_editable.
{{ 'main' | page_editable }}Global_editable
A global editable is an editable that will have the same content on every page where that global editable is being shown. Global editables will get a orange border in the live editing tool.
If you were to create an editable with the id main in your template, each page that is using that template will show the exact same content. So, if you change the content inside the global_editable on one page, the changes will be visible on all pages that is using the main global_editable.
{{ 'main' | global_editable }}Check if editable has content
Sometimes you want to check if an editable has content or not. This can come in handy when you only want the editable to show (e.g. take up space on the page) if it has content.
{{ 'main' | has_page_editable }}
or...
{{ 'footer' | has_global_editable }}true (string, not boolean)
or...
false (string, not boolean)
Only show div if editable has content
The following code will only show the editable is it has content. But if you're logged in to WM3 the editable will always be visible. So this only applies to when you're not in admin-mode.
{% capture hascontent %}{{ 'main' | has_page_editable }}{% endcapture %}
{% if hascontent == 'true' %}
{{ 'main' | page_editable }}
{% endif %}AJAX Templates
Pages have a template assigned to them in the edit form and this template (in the following referred to as page template) is used when rendering the page. However if the page url is access through a JSON or JS request, the server will try to find a template with the page template name plus '.ajax' and use it instead. This can be used to load only partial content of the page. If no such template is found, the page template is used.
Here is an example:
Page template name
'default', extension/type: 'tpl', final name: 'default.tpl'
Page ajax template name
'default.ajax', extension/type: 'tpl', final name: 'default.ajax.tpl'
Snippets
Ancestors & Breadcrumbs
Ancestors can be retrieved from a page by using the ancestors method.
Here is an example to get the current page breadcrumbs:
{% for ancestor in page.ancestors %}
<span>\ {{ ancestor.title }}</span>
{% endfor %}
<span>\ {{ page.title }}</span>
Get all pages by tags
You can get a list with all pages that has been tagged with a tag:
{% assign pages = 'popular, cool' | pages_by_tags %}
{% for p in pages %}
<p>{{ p.title }} </p>
{% endfor %}
Get all pages groups by first letter
<ul>
{% for group in site.grouped_pages %}
<li>
{{ group[0] }}
<ul>
{% for page in group[1] %}
<a href="{{ page.url }}">{{ page.title }}</a>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
Get all pages
<ol>
{% for page in site.all_pages %}
<li><a href="{{ page.url }}">{{ page.title }}</a></li>
{% endfor %}
</ol>
Rough outline for using Open Graph
<meta property="og:title" content="{{ page.og_title }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://example.com{{ page.url }}" />
<meta property="og:description" content="{{ page.og_description }}" />
<meta property="og:image" content="{{ page.og_image }}" />
Updated: 2020-10-30