Skip to content

Commit

Permalink
[ci] yarn format
Browse files Browse the repository at this point in the history
  • Loading branch information
drwpow authored and actions-user committed Aug 18, 2021
1 parent b5e5dcf commit 737c101
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/src/pages/guides/markdown-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export default {
Astro treats any `.md` files inside of the `/src/pages` directory as pages. These files can contain frontmatter, but are otherwise processed as plain markdown files and do not support components. If you're looking to embed rich components in your markdown, take a look at the [Markdown Component](#astros-markdown-component) section.

### Layouts

Markdown pages have a special frontmatter property for `layout`. This defines the relative path to an `.astro` component which should wrap your Markdown content, for example a [Layout](/core-concepts/layouts) component. All other frontmatter properties defined in your `.md` page will be exposed to the component as properties of the `content` prop. The rendered Markdown content is placed into the default `<slot />` element.

```jsx
// src/pages/index.md
---
Expand All @@ -64,6 +66,7 @@ title: My cool page

# Hello World!
```

```jsx
// src/layouts/BaseLayout.astro
---
Expand All @@ -81,6 +84,7 @@ const { content } = Astro.props;
```

For Markdown files, the `content` prop also has an `astro` property which holds special metadata about the page such as the complete Markdown `source` and a `headers` object. An example of what a blog post `content` object might look like is as follows:

```json
{
/** Frontmatter from a blog post
Expand All @@ -100,14 +104,15 @@ For Markdown files, the `content` prop also has an `astro` property which holds
"depth": 2,
"text": "Responsive partial hydration",
"slug": "responsive-partial-hydration"
},
}
/* ... */
],
"source": "# Astro 0.18 Release\\nA little over a month ago, the first public beta [...]"
},
"url": ""
}
```

> Keep in mind that the only guaranteed properties coming from the `content` prop are `astro` and `url`.
## Astro's Markdown Component
Expand Down

0 comments on commit 737c101

Please sign in to comment.