How to use page fields and global variables?

Page fields and global variables can be used inside code of pages/parts/layouts/snippets as predefined variables:

<h1 class="title">{% page.fields['field_name']%}</h1> <!-- field from current page -->

{% pages['page_name'].fields['field_name'] %} <!-- field from 'page_name' page -->

<p>{% assign new_variable = site.variables['promotion_active'] %}</p> <!-- get global variable value... -->
<b>{{new_variable}}</b> <!-- ...and use it inside code -->
Was this article helpful? Yes  No
416 from 466 found this helpful