Variables
Jekyll traverses your site looking for files to process. Any files with front matter are subject to processing. For each of these files, Jekyll makes a variety of data available via Liquid. The following is a reference of the available data.
Global Variables
Variable | Description |
---|---|
|
Site wide information + configuration settings from |
|
Page specific information + the front matter. Custom variables set via the front matter will be available here. See below for details. |
|
Layout specific information + the front matter. Custom variables set via front matter in layouts will be available here. |
|
Jekyll-centric information will be available here. See below for details. |
|
Theme-gem specific information as defined in the theme's gemspec. Useful for rendering information in the theme demo's "About" page, for example. See below for details. |
|
In layout files, the rendered content of the Post or Page being wrapped. Not defined in Post or Page files. |
|
When the |
Site Variables
Variable | Description |
---|---|
|
The current time (when you run the |
|
A list of all Pages. |
|
A reverse chronological list of all Posts. |
|
If the page being processed is a Post, this contains a list of up to ten related Posts. By default, these are the ten most recent posts. For high quality but slow to compute results, run the |
|
A list of all static files (i.e. files not processed by Jekyll's converters or the Liquid renderer). Each file has five properties: |
|
A subset of |
|
A subset of |
|
A list of all the collections (including posts). |
|
A list containing the data loaded from the YAML files located in the |
|
A list of all the documents in every collection. |
|
The list of all Posts in category |
|
The list of all Posts with tag |
|
Contains the url of your site as it is configured in the |
|
All the variables set via the command line and your |
Page Variables
Variable | Description |
---|---|
|
The content of the Page, rendered or un-rendered depending upon what Liquid is being processed and what |
|
The title of the Page or Document resource. |
|
The un-rendered excerpt of a Page or Document. Can be overridden in the front matter. It can either be disabled atomically for certain page or document by setting an empty string to an |
|
The URL of the Post without the domain, but with a leading slash, e.g. |
|
The Date assigned to the Post. This can be overridden in a Post's front matter by specifying a new date/time in the format |
|
An identifier unique to a document in a Collection or a Post (useful in RSS feeds). e.g. |
|
The list of categories to which this post belongs. Categories are derived from the directory structure above the |
|
The label of the collection to which a Document belongs. e.g. |
|
The list of tags to which this post belongs. These can be specified in the front matter. |
|
The path between the source directory and the file of a page, e.g. |
|
The filename of the post or page, e.g. |
|
The path to the raw post or page, relative to the source directory. Example usage: Using a combination of the repository's blob URL and this page variable to get the full URL to the file in the repository. This can be overridden in the front matter. |
|
The filename of a Document resource without its extension (or date prefixes for a post). For example, slug for a post at URL |
|
The file extension of a Document resource. For example, |
|
The next post relative to the position of the current post in |
|
The previous post relative to the position of the current post in |
ProTip™: Use Custom Front Matter
Any custom front matter that you specify will be available under
page
. For example, if you specify custom_css: true
in a page’s front matter, that value will be available as page.custom_css
.
If you specify front matter in a layout, access that via layout
.
For example, if you specify class: full_page
in a layout’s front matter,
that value will be available as layout.class
in the layout and its parents.
Jekyll Variables
Variable | Description |
---|---|
|
Version of Jekyll used to build the site. |
|
Value assigned to environment variable |
Theme Variables4.3.0
Variable | Description |
---|---|
|
Absolute path to the theme-gem. Rendered only when environment variable |
|
Comma separated string composed of the authors of the theme-gem. |
|
Description or summary of the theme-gem as specified in the theme gemspec. |
|
The version string of current theme. |
|
List of runtime dependencies of the theme. |
|
A mapping of key-value pairs as defined in the theme gemspec. |
Paginator
Variable | Description |
---|---|
|
The number of the current page |
|
Number of posts per page |
|
Posts available for the current page |
|
Total number of posts |
|
Total number of pages |
|
The number of the previous page, or |
|
The path to the previous page, or |
|
The number of the next page, or |
|
The path to the next page, or |
Paginator variable availability
These are only available in index files, however they can be located in a subdirectory,
such as /blog/index.html
.