Variables
Hakyllbars comes with a set of default variables. Variables are interpolated into templates by using {{
handlebars }}
.
Basic variables
body
The body of the current item being compiled.
host
The site hostname. This variable is configurable.
Here, the value of {{host}}
is https://keywordsalad.github.io
.
siteRoot
The root of the site, consisting of the hostname and any path. This variable is configurable.
Here, the value of {{siteRoot}}
in /hakyllbars
.
siteUrl
The absolute url to the site root. A helper that concatenates {{host}}{{siteRoot}}
.
Here, the value of {{siteUrl}}
is https://keywordsalad.github.io/hakyllbars
.
path
The path to the current item being compiled.
Here, the {{path}}
is variables.md
.
url
The URL to the current item being compiled.
Here, the {{url}}
is /hakyllbars/variables/
.
absUrl
The absolute URL to the current item being compiled including hostname.
Here, the {{absUrl}}
is https://keywordsalad.github.io/hakyllbars/variables/
.
updated
Gets when the current item being compiled was updated, published, or created via metadata.
Here, the {{updated}}
is 2023-02-26T16:08:40-0800
.
published
Gets when the current item being compiled with published or created via metadata.
Here, the {{published}}
is 2023-02-26T16:08:40-0800
.
title
Gets the title of the current item being compiled from metadata or derives the title from the item’s filename.
Here, the {{title}}
is Variables
.
git variables
These variables are useful for displaying metadata on pages about when they were last modified.
gitWebUrl
The URL to the site’s git repository web viewer. This variable is configurable.
Here, the {{gitWebUrl}}
is https://github.com/keywordsalad/hakyllbars/tree
.
gitSha1
The git SHA-1 hash of the current item being compiled.
Here, the {{gitSha1}}
is c3e3df3
.
gitMessage
The latest git commit message for which the current item was last modified.
Here, the {{gitMessage}}
is Adding examples for variables
.
gitBranch
The git branch from which the current item is compiled.
Here, the {{gitBranch}}
is main
.
gitFilePath
The path to the current item being compiled within the git repository.
Here, the {{gitFilePath}}
is site/variables.md
.
gitFileName
The filename of the current file being compiled within the git repository.
Here, the {{gitFileName}}
is variables.md
.
isFromSource
Indicates whether the current item being compiled is produced from source or is instead produced from generated data.
Here, the {{isFromSource}}
is True
.
isChanged
Indicates whether the current item being compiled has uncommitted changes.
Here, the {{isChanged}}
is False
.