Skip to content

Commit

Permalink
reworked to flow off of layout section
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah11918 authored Mar 24, 2022
1 parent 9ca8b1d commit 75f19b2
Showing 1 changed file with 8 additions and 34 deletions.
42 changes: 8 additions & 34 deletions src/pages/en/guides/markdown-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ An example blog post `content` object might look like:
"author": "Matthew Phillips",
"description": "Astro 0.18 is our biggest release since Astro launch.",
"draft": false,
"keywords": ["astro", "release", "announcement"]
**/
"astro": {
"headers": [
Expand All @@ -101,6 +102,13 @@ An example blog post `content` object might look like:

> 💡 `astro` and `url` are the only guaranteed properties provided by Astro in the `content` prop. The rest of the object is defined by your frontmatter variables.
### Frontmatter as Props

Any Astro component (not just layouts!) can receive the values defined in your Markdown frontmatter as props. You can specify several types of data using YAML frontmatter, and capture even richer meta information from each blog post to use throughout your Astro site.

Access these values in any `.astro` file as you would in a layout, as described above.


### Markdown Drafts

`draft: true` is an optional frontmatter value that will mark an individual `.md` page or post as "unpublished." By default, this page will be excluded from the site build.
Expand Down Expand Up @@ -152,40 +160,6 @@ export default /** @type {import('astro').AstroUserConfig} */ ({

In addition to supporting standard Markdown syntax, Astro also extends Markdown to make your content even more expressive. Below are some Markdown features that only exist in Astro.

### Frontmatter in Markdown

Contents placed within the Frontmatter of each `.md` file can be written in `YAML` a form of expressive markup where you can specify your data in all manner of sutible data types. This way you can capture even richer information from each blog post and be able express this meta information in Astro in more places.

```md
---

book:
title : "The complete stories"
author : "Isaac Asimov"
year : 1990
links :
homepage: "https://..."
keywords : ['sci-fi','Earth is room enough', ...]
---
```

This following `YAML` expression would then be availble to you via the `Astro.props.content` in the following manner:

```js
content:{
book:{
title : "The complete stories",
author : "Isaac Asimov",
year : 1990,
links:{
homepage: "https://..."
},
keywords: ['sci-fi', 'Earth is room enough', ...]
}
}
```



### Using Variables in Markdown

Expand Down

0 comments on commit 75f19b2

Please sign in to comment.