Postleaf exposes a handful of global variables you can use in your themes. Each global has a number of properties you can reference, all outlined below.


The Request global exposes a number of properties about the page that was requested.

  • body – all POST data attached to the request
  • cookies – all cookie data attached to the request
  • host – the hostname and port number, e.g.
  • hostname – the hostname, e.g.
  • isHomepage – true only if the page being rendered is the homepage
  • path – the request path, e.g. /post-slug
  • query – the request's query params
  • secure – true only if the request is served over SSL
  • url – the full URL that was requested


The Settings global exposes Postleaf's settings. This makes it useful for outputting your website's title, tagline, favicon, cover photo, and more.

  • cover – the path to your blog's cover photo
  • customHomepage – if a custom homepage is set, this property will contain its slug
  • defaultPostContent – The default content shown in the editor
  • defaultPostTitle – the default title shown in the editor
  • favicon – the path to the website's favicon
  • footCode – code that gets injected into the {foot/} helper
  • headCode – code that gets injected into the {head/} helper
  • language – the current language code
  • logo – the path to the website's logo
  • postsPerPage – the number of posts to display in a post loop
  • tagline – the website's tagline
  • theme – the current theme's id
  • timeZone – the current time zone
  • title – the website's title


The Template global exposes information about the current template.

  • name – the template's filename (without extension)


If a user is logged in, the User global will be set and the following properties will be made available. If a user is not logged in, this value will be undefined.

  • id – the user's id
  • name – the user's name
  • email – the user's email address
  • role – the user's role
  • avatar – the path to the user's avatar
  • image – the path to the user's cover image
  • location – the user's location
  • bio – the user's bio as a Markdown string
  • website – the user's website

How to Use Globals

Globals can be used just like any other variable. Here are some examples:

{! Output the title and tagline !}
<p class="tagline">{Settings.tagline}</p>

{! Check for the homepage !}
Not the homepage!

{! Show the cover photo !}
<img src="{@url path=Settings.cover/}" alt="Cover Photo">

Note that, like all variables in Dust.js templates, globals are read-only.