From 7925c9a80e6aaa6c88c938568fcd8c532787e0c8 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sat, 29 Jul 2023 15:52:51 +0530 Subject: [PATCH] . --- docs/guide/data-loading.md | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) 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 {/* ... */} + }) } }) ```