#access title value from frontmatter

3 messages · Page 1 of 1 (latest)

mild jay
#

let's say i have some frontmatter like this:

title: Bridge Relayer API
description: A reference page for the Bridge Relayer API

can i do something like this:

title: Bridge Relayer API
description: A reference page for the {{frontmatter.title}}

grave heronBOT
#

Hi @mild jay. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

In Astro, you can access the frontmatter values in your Astro or Markdown files. However, using frontmatter values within the frontmatter itself, as you've shown in your example, is not supported.

Here's how you can access the title value from the frontmatter in your Astro or Markdown files:

---
title: 'Bridge Relayer API'
description: 'A reference page for the Bridge Relayer API'
---

<h1>{Astro.props.frontmatter.title}</h1>
<p>{Astro.props.frontmatter.description}</p>

In this example, Astro.props.frontmatter.title and Astro.props.frontmatter.description will access the title and description values from the frontmatter.

For more details, you can refer to the Astro documentation on Markdown & MDX (https://docs.astro.build/en/guides/markdown-content#importing-markdown) and Layouts (https://docs.astro.build/en/core-concepts/layouts#using-one-layout-for-md-mdx-and-astro).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: