Template variables
blog_page_path
blog_page_path
Note: Only available within blog templates currently.
Get the page path of the blog root page. Example if you have a blog under https://www.example.com/locations/seattle/blog/
the blog_page_path
would be /blog/
blog_root
blog_root
Note: Only available within blog templates currently.
Get the URL of the blog root page. Includes the base_directory
. Example if you have a blog under https://www.example.com/locations/seattle/blog/
the blog_root
would be /locations/seattle/blog/
filter_posts
filter_posts
Get blog posts for the current site based on a supplied category slug. Note: Only available within blog templates currently.
get_categories
get_categories
Get list of all the current blog categories and links. Note: Only available within blog templates currently.
Other available category values
Value | Description |
---|---|
| Total number of posts in that category (i.e |
| Slug of the category (i.e. |
now
now
Python datetime object with properties of the current day and time.
Example of outputting the year (i.e. 2024
)
Available properties
now.year
now.month
now.day
now.hour
now.minute
strftime
can be used to format the date. Format variables available here
Example of outputting YYYY-MM-DD
pages
pages
This utility allows you to access and filter the current Pages within a Site.
Output all pages
Filtering pages
Example of filtering pages by template page type
Ordering pages
Accessing custom fields
Get a single page
Available page fields
Standard page fields used in templates
Property | 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 | /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 |
pages.as_navigation
pages.as_navigation
Utility for easily creating multi-level navigations for headers, footers and sidebars. Its setup to do recursive looping of items to support any depth
of page navigations
Simple example - Full sitemap
Gets all the pages within the Site, then recursively outputs nested <ul>
and <li>
elements
Sidemenu example
Example of grabbing all pages based on a starting path, then outputting them with a headline. The item.depth == 0
is used to determine it is the first parent page (/services/
) and then the subpages (/services/some-service/)
are output in <ul>
You can also add additional differences in the output based on the depth by using item.depth
Last updated