# 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:

Property Description
.title The page title
.description The page description or excerpt
.url The full URL of the page
.path The root-relative path to the page
.filePath The file system path to the source file
title: {{ content["getting-started"].title }}
description: {{ content["getting-started"].description }}
url: {{ content["getting-started"].url }}
path: {{ content["getting-started"].path }}

# 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"].path }}).
{{ 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.path }})
{{ 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.

{{ for item in content.search("retype") | array.limit 5 ~}}
[!card vert]({{ item.path }})
{{ end }}


# Tags

# List all tags

content.tags returns all tags defined across the project. Each tag has a title and a pages array.

{{ for tag in content.tags ~}}
- [{{ tag.title }}](/tags/{{ tag.title }}) ({{ tag.pages | array.size }} pages)
{{ end }}

# Pages for a specific tag

{{ for page in content.tags["guide"].pages ~}}
- [{{ page.title }}]({{ page.path }})
{{ end }}

# 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.

{{ for author in content.authors ~}}
- {{ author.name }} ({{ author.pages | array.size }} pages)
{{ end }}

# Pages by a specific author

{{ for page in content.authors["Jane Smith"].pages ~}}
- [{{ page.title }}]({{ page.path }})
{{ end }}

# 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].path }})

# List all blog posts

{{ for post in content.blog.posts ~}}
1. [{{ post.title }}]({{ post.path }})
{{ end }}
  1. What's New in Retype v4.1
  2. Self-hosting Obsidian Vault with Retype
  3. What's New in Retype v4.0
  4. What's New in Retype v3.12
  5. What's New in Retype v3.11
  6. What's New in Retype v3.10
  7. New GitHub Pages Community Key
  8. What's New in Retype v3.9
  9. What's New in Retype v3.8

# Most recent as Cards

{{ for post in content.blog.posts | array.limit 3 ~}}
[!card vert]({{ post.path }})
{{ end }}


# Navigation

content.nav exposes the project's navigation tree. Use .children to access the top-level items.

# List top-level navigation items

{{ for item in content.nav.children ~}}
- {{ item.label }} ({{ item.children | array.size }} children)
{{ end }}
  • LICENSE (0 children)
  • About (0 children)
  • Changelog (0 children)
  • Community (0 children)
  • Faq (0 children)
  • Feature log (0 children)
  • Features (0 children)
  • Components (27 children)
  • Blog (9 children)
  • Templating (5 children)
  • Pro (1 children)
  • Hosting (8 children)
  • Samples (7 children)
  • Configuration (6 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