Helpers are functions that can be used in templates.

_url

Returns a url with the root path prefixed.

{{ _url(path) }}

Example

{{ _url('path') }}
// /root/path

{{ _url() }}
// /

_time

Inserts formatted date. date can be unix time, ISO string, date object. Visit Moment.js for more infomation

{{ _time(date, format) }}

example

{{ _time(Date.now(), 'YYYY') }}
// 2018

i18n

Use __ or _n helpers in templates to get the translated strings.

{{ __(page.title) }}
{{ _n(page.posts) }}

example

# i18n config yml
index:  
  title: Home
posts: 
  zero: No posts
  one: One post
  other: %d posts
{{ __('index.title') }}
// Home

{{ _n('posts', 3) }}
// 3 posts

_posts

Returns all posts or specific post.

{{ _posts([id]) }}

example

{{ _posts() }}
// [ ... ] Array

{{ _posts(7218771) }}
// { ... } Object 

_pages

Returns all pages or specific page.

{{ _pages([id]) }}

example

{{ _pages() }}
// [ ... ] Array

{{ _pages(7218771) }}
// { ... } Object 

_categories

Returns all categories or specific category.

{{ _categories([id]) }}

example

{{ _categories() }}
// [ ... ] Array

{{ _categories(6777) }}
// { ... } Object

_tags

Returns all tags or or specific tag

{{ _tags() }}

example

{{ _tags() }}
// [ ... ] Array

{{ _tags(676776) }}
// { ... } Object