Skip to content

Commit

Permalink
Update the shape of data provided by Astro.fetchContent("./*.md") (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jasikpark authored Jun 16, 2021
1 parent eba4d81 commit 02d175c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ const data = Astro.fetchContent('../pages/post/*.md'); // returns an array of po

`.fetchContent()` only takes one parameter: a relative URL glob of which local files you’d like to import. Currently only `*.md` files are supported. It’s synchronous, and returns an array of items of type:

```
```js
{
url: string; // the URL of this item (if it’s in pages/)
content: string; // the HTML of this item
// frontmatter data expanded here
}[];
/** frontmatter from the post.. example frontmatter:
title: '',
tag: '',
date: '',
image: '',
author: '',
description: '',
**/
astro: {
headers: [], // TODO: document what this means
source: '' // raw source of the markdown file
},
url: '' // the rendered path
}[]
```

#### `request`
Expand Down

1 comment on commit 02d175c

@vercel
Copy link

@vercel vercel bot commented on 02d175c Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.