diff --git a/docs/guide/data-loading.md b/docs/guide/data-loading.md index bbe96c37..86c4f30b 100644 --- a/docs/guide/data-loading.md +++ b/docs/guide/data-loading.md @@ -140,23 +140,19 @@ import { createContentLoader } from 'vitepress' export default createContentLoader('posts/*.md', { includeSrc: true, // include raw markdown source? - render: true, // include rendered full page HTML? - excerpt: true, // include excerpt? + render: true, // include rendered full page HTML? + excerpt: true, // include excerpt? transform(rawData) { // map, sort, or filter the raw data as you wish. // the final result is what will be shipped to the client. - return rawData - .sort((a, b) => { - return +new Date(b.frontmatter.date) - +new Date(a.frontmatter.date) - }) - .map((page) => { - page.src // raw markdown source - page.html // rendered full page HTML - page.excerpt // rendered excerpt HTML (content above first `---`) - return { - /* ... */ - } - }) + return rawData.sort((a, b) => { + return +new Date(b.frontmatter.date) - +new Date(a.frontmatter.date) + }).map((page) => { + page.src // raw markdown source + page.html b // rendered full page HTML + page.excerpt // rendered excerpt HTML (content above first `---`) + return {/* ... */} + }) } }) ```