Content
Use content to query and access any page in your project from within a template expression. You can look up pages by key, search across all pages, and iterate over collections such as tags, categories, authors, blog posts, and navigation items.
For page-level metadata, see Page properties. For project configuration values, see Project properties.
Page lookup
By key
Retrieve any page using content["key"], where the key is the page's filename (without extension), its title, or a relative path.
{{ content["getting-started"] }}
All of the following forms resolve the same page:
{{ content["getting-started"] }}
{{ content["Getting Started"] }}
{{ content["guides/getting-started"] }}
Page properties
Once you have a page reference, you can access all the page settings, including:
title: {{ content["getting-started"].title }}
description: {{ content["getting-started"].description }}
url: {{ content["getting-started"].url }}
path: {{ content["getting-started"].path }}
filePath: {{ content["getting-started"].filePath }}
Output
title: Getting Started
description: This guide will have you up and running generating your own Retype website in just a few minutes.
url: https://retype.com/guides/getting-started/
path: /guides/getting-started/
filePath: /guides/getting-started.md
Render as a card
Pass a page filePath to the [!card] component to render a linked card for that page.
[!card]({{ content["getting-started"].filePath }})
Or use vertical cards:
[!card vert]({{ content["getting-started"].filePath }})
Conditional display
Check whether a page exists before linking to it. This is useful for optional or tier-specific content.
{{ if content["premium-features"] }}
Check out our [Premium Features]({{ content["premium-features"].filePath }}).
{{ end }}
Search
Use content.search("term") to find pages whose title contains the search term. Results are returned as an array of page objects.
Basic search
{{ for item in content.search("obsidian") ~}}
- [{{ item.title }}]({{ item.filePath }})
{{ end }}
Access a specific result
title: {{ content.search("getting started")[0].title }}
description: {{ content.search("getting started")[0].description }}
title: Getting Started
description: This guide will have you up and running generating your own Retype website in just a few minutes.
Limit search results
Combine with the array.limit filter to cap the number of results. The following sample then outputs each of the results into a compact card component:
{{ for item in content.search("retype") | array.limit 5 ~}}
[!card compact]({{ item.filePath }})
{{ end }}
Tags
List all tags
content.tags returns all tags defined across the project. Each tag has a title and a pages array.
Pages for a specific tag
The following sample demonstrates how to get all the Pages based on a specific tag:
{{ for page in content.tags["guide"].pages ~}}
- [{{ page.title }}]({{ page.filePath }})
{{ end }}
- Cloudflare Pages
- Docker
- Publish using FTP
- GitHub Pages
- GitLab Pages
- Heroku
- Netlify
- Blogging
- Retype CLI
- Getting Started
- GitHub Actions
- Markdown
- Themes
- Troubleshooting
Categories
List all categories
content.categories returns all categories defined across the project. Each category has a title and a pages array.
{{ for cat in content.categories ~}}
- [{{ cat.title }}](/categories/{{ cat.title }}) ({{ cat.pages | array.size }} pages)
{{ end }}
Authors
List all authors
content.authors returns all authors across the project. Each author entry has a name and a pages array.
Pages by a specific author
Blog Posts
content.blog.posts returns all blog posts in the project, ordered by date descending.
Latest as a Card
[!card]({{ content.blog.posts[0].filePath }})
List all blog posts
{{ for post in content.blog.posts ~}}
1. [{{ post.title }}]({{ post.filePath }})
{{ end }}
- What's New in Retype v4.3
- What's New in Retype v4.2
- What's New in Retype v4.1
- Self-hosting Obsidian Vault with Retype
- What's New in Retype v4.0
- What's New in Retype v3.12
- What's New in Retype v3.11
- What's New in Retype v3.10
- New GitHub Pages Community Key
- What's New in Retype v3.9
- What's New in Retype v3.8
Most recent as Cards
{{ for post in content.blog.posts | array.limit 3 ~}}
[!card vert]({{ post.filePath }})
{{ end }}
Navigation
content.nav exposes the project's navigation tree. Use .children to access the top-level items.
List top-level navigation items
- LICENSE (0 children)
- About (0 children)
- Changelog (0 children)
- Community (0 children)
- Faq (0 children)
- Feature log (0 children)
- Features (0 children)
- Components (28 children)
- Blog (11 children)
- Templating (5 children)
- Pro (1 children)
- Hosting (8 children)
- Samples (7 children)
- Configuration (7 children)
- Guides (9 children)
- Not Found (0 children)
All pages
content.pages is an array of all pages in the project. Use standard array filters to slice and query the list.
Access a page by index
title: {{ content.pages[0].title }}
description: {{ content.pages[0].description }}
Build a related pages section
Combine content.pages with array filters for curated page grids.
Escaping template syntax
Inline escaping
To display literal {{ }} syntax without the template engine processing it, wrap the content in opening {%{ and closing }%} escape tags:
{%{ {{ content["getting-started"].title }} }%}
Page-level escaping
To disable templating for an entire page, set templating: false in the page frontmatter:
---
templating: false
---
Project-level escaping
To disable templating project-wide, update your retype.yml with the following:
templating:
enabled: false