#MD file content not being outputted through template

3 messages · Page 1 of 1 (latest)

wild wyvern
#

Hi team 👋🏾 . In my project, I have created a layout that every post must use for styling and structure (project-template). Currently the default for prop 'projectDescription' in the project template is being displayed instead of the productDescription data from my post.md file. How do I structure the md file so that it's data is being displayed instead of the default in the template? Thanks in advance.

Code snippet for template:

import Head from "../components/head.astro";
const {
frontmatter,
projectDescription = "Introduce your project in a sentence",
} = Astro.props;

         <h1 class="project-hero__h1">{frontmatter.title}</h1>
          <h2 class="project-hero__h2">{projectDescription}</h2>

My post file has the following code snippet:


layout: ../../layouts/project-template.astro
title: "Tayo's Mixing Bowl"
isDraft: false
tags: ["wordpress", "ecommerce"]
projectDescription: "Decadent brownies made to order from our kitchen to your door"

coarse reefBOT
#
Quiet in here?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

pliant rain
#

You can change the destructuring of your props to this: ```ts
const {
title,
projectDescription = "Introduce your project in a sentence",
} = Astro.props.frontmatter;