Update the shape of data provided by Astro.fetchContent("./*.md") (#479)

This commit is contained in:
Caleb Jasik 2021-06-16 17:39:47 -05:00 committed by GitHub
parent eba4d81bf3
commit 02d175cd95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 youd like to import. Currently only `*.md` files are supported. Its synchronous, and returns an array of items of type:
```
```js
{
url: string; // the URL of this item (if its 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`