Skip to content

# Available variables

This plugin offers the following timestamp variables:

variable | description
--- | ---
`git_revision_date_localized` | Last git commit that touched a file. Enabled by default.
`git_creation_date_localized` | First git commit that touched a file. Enable in options.
`git_site_revision_date_localized` | Last git commit that touched any file in the `docs/` folder. Enabled by default.

You can use these variables wrapped in curly brackets (`{{` and `}}`) anywhere in a markdown file, like so:

    This page was last updated: *{{ git_revision_date_localized }}*

Example output: This page was last updated {{ git_revision_date_localized }}.

Changing the `type`, `timezone` and/or `locale` in the options will effect the output of these variables. To change the styling see Applying custom styling.

## Variables for overriding themes

If you do not want to include revision dates manually in each markdown file, or if you would like more control on the formatting, you can override a theme. You can use the same three variables but with a `page.meta.` prefix:

- `page.meta.git_revision_date_localized`
- `page.meta.git_creation_date_localized`
- `page.meta.git_revision_date_localized_raw_date`

To allow for more flexibility when overriding a theme there are also variables for each different `type` available (regardless of the setting for `type` in options), where the output is also not wrapped in `<span>` elements (so you can do the CSS styling yourself):

- `page.meta.git_revision_date_localized_raw_date`
- `page.meta.git_revision_date_localized_raw_datetime`
- `page.meta.git_revision_date_localized_raw_iso_date`
- `page.meta.git_revision_date_localized_raw_iso_datetime`
- `page.meta.git_revision_date_localized_raw_timeago`
- `page.meta.git_revision_date_localized_raw_custom`

They are also available on the entire site level:

- `page.meta.git_site_revision_date_localized_raw_datetime`
- `page.meta.git_site_revision_date_localized_raw_iso_date`
- `page.meta.git_site_revision_date_localized_raw_date`
- `page.meta.git_site_revision_date_localized_raw_iso_datetime`
- `page.meta.git_site_revision_date_localized_raw_timeago`
- `page.meta.git_site_revision_date_localized_raw_custom`

And if you've enabled creation date in the config:

- `page.meta.git_creation_date_localized_raw_date`
- `page.meta.git_creation_date_localized_raw_datetime`
- `page.meta.git_creation_date_localized_raw_iso_date`
- `page.meta.git_creation_date_localized_raw_iso_datetime`
- `page.meta.git_creation_date_localized_raw_timeago`
- `page.meta.git_creation_date_localized_raw_custom`

We also expose the git hash and the git tag (empty if not tag associated with the commit):

- `page.meta.git_revision_date_localized_hash`
- `page.meta.git_revision_date_localized_tag`
- `page.meta.git_site_revision_date_localized_hash`
- `page.meta.git_site_revision_date_localized_tag`
- `page.meta.git_creation_date_localized_hash`
- `page.meta.git_creation_date_localized_tag`

timeago.js dependency

The `*_timeago` variables require the timeago.js dependency. This is automatically injected when the option `type: timeago` is set. Alternatively, you can add timeago.js using the `extra_javascript` option of MkDocs:

    # mkdocs.yml
    extra_javascript:
        - js/timeago.min.js
        - js/timeago_mkdocs_material.js

You can download both these files from GitHub.