docs: add README reference
This commit is contained in:
parent
a97781af62
commit
d402d4b380
1 changed files with 14 additions and 0 deletions
|
@ -237,6 +237,20 @@ const { Content } = await entry.render();
|
|||
/>
|
||||
```
|
||||
|
||||
### Access frontmatter and content collection information from your templates
|
||||
|
||||
You can access content collection information from your Markdoc templates using the `$entry` variable. This includes the entry `slug`, `collection` name, and frontmatter `data` parsed by your content collection schema (if any). This example renders the `title` frontmatter property as a heading:
|
||||
|
||||
```md
|
||||
---
|
||||
title: Welcome to Markdoc 👋
|
||||
---
|
||||
|
||||
# {% $entry.data.title %}
|
||||
```
|
||||
|
||||
The `$entry` object matches [the `CollectionEntry`type](https://docs.astro.build/en/reference/api-reference/#collection-entry-type), excluding the `.render()` property.
|
||||
|
||||
### Markdoc config
|
||||
|
||||
The Markdoc integration accepts [all Markdoc configuration options](https://markdoc.dev/docs/config), including [tags](https://markdoc.dev/docs/tags) and [functions](https://markdoc.dev/docs/functions).
|
||||
|
|
Loading…
Reference in a new issue