mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
Update the shape of data provided by Astro.fetchContent("./*.md")
(#479)
This commit is contained in:
parent
eba4d81bf3
commit
02d175cd95
1 changed files with 15 additions and 5 deletions
20
docs/api.md
20
docs/api.md
|
@ -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:
|
`.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/)
|
/** frontmatter from the post.. example frontmatter:
|
||||||
content: string; // the HTML of this item
|
title: '',
|
||||||
// frontmatter data expanded here
|
tag: '',
|
||||||
}[];
|
date: '',
|
||||||
|
image: '',
|
||||||
|
author: '',
|
||||||
|
description: '',
|
||||||
|
**/
|
||||||
|
astro: {
|
||||||
|
headers: [], // TODO: document what this means
|
||||||
|
source: '' // raw source of the markdown file
|
||||||
|
},
|
||||||
|
url: '' // the rendered path
|
||||||
|
}[]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `request`
|
#### `request`
|
||||||
|
|
Loading…
Add table
Reference in a new issue