#
Page and Project variables
Retype exposes page.* and project.* variables within the templating engine, allowing you to dynamically reference page metadata and project configuration values throughout your content.
These variables make it easy to keep your documentation consistent and avoid hardcoding values that might change.
#
Page variables
Use page.* to access any metadata property from the current page's frontmatter.
#
Basic example
---
author: Jane Smith
---
This guide was written by {{ page.author }}.
#
Output
This guide was written by Jane Smith.
#
Common Page properties
#
Working with arrays
Access individual items in arrays using bracket notation:
---
tags: [guide, tutorial, beginner]
authors: [Alice, Bob, Charlie]
---
First tag: {{ page.tags[0] }}
Second author: {{ page.authors[1] }}
#
Output
First tag: guide
Second author: Bob
#
Nested properties
Page metadata objects can be accessed using dot notation:
---
author:
name: Jane Smith
email: jane@example.com
meta:
title: Custom SEO Title
description: A brief page description
---
Author: {{ page.author.name }}
Email: {{ page.author.email }}
Meta title: {{ page.meta.title }}
#
Output
Author: Jane Smith
Email: jane@example.com
Meta title: Custom SEO Title
#
Project variables
Use project.* to access any configuration value from your retype.yml file.
#
Basic example
Welcome to {{ project.branding.title }}!
If your retype.yml contains:
branding:
title: My Documentation
#
Output
Welcome to My Documentation!
#
Common Project properties
#
Accessing links
Project links property is available as an array:
{{ for link in project.links }}
1. {{ link.text }}
{{ end }}
#
Output
- Pro Pricing
- Blog & News
- Support
- Social
Or, individually by index:
First link: {{ project.links[0].text }}
Third link: {{ project.links[2].text }}
#
Output
First link: Pro Pricing
Third link: Support
#
Escaping template syntax
#
Inline escaping
To display literal {{ }} syntax without the template engine processing it, wrap the content in opening {%{ and closing }%} escape tags:
{%{ {{ page.title }} }%}
This is useful when documenting template syntax or showing code samples that include double curly braces.
#
Page-level escaping
To disable templating for an entire page, set templating: false in the page settings:
---
templating: false
---
#
Project-level escaping
To disable templating project-wide, update your retype.yml with the following:
templating:
enabled: false