Migrate to astro v5 beta: first round

This commit is contained in:
prototypa
2024-10-04 03:34:51 -04:00
parent 52188af681
commit 953c4f2408
13 changed files with 382 additions and 1179 deletions

View File

@@ -1,5 +1,5 @@
import type { PaginateFunction } from 'astro';
import { getCollection } from 'astro:content';
import { getCollection, render } from 'astro:content';
import type { CollectionEntry } from 'astro:content';
import type { Post } from '~/types';
import { APP_BLOG } from 'astrowind:config';
@@ -41,8 +41,8 @@ const generatePermalink = async ({
};
const getNormalizedPost = async (post: CollectionEntry<'post'>): Promise<Post> => {
const { id, slug: rawSlug = '', data } = post;
const { Content, remarkPluginFrontmatter } = await post.render();
const { id, data } = post;
const { Content, remarkPluginFrontmatter } = await render(post);
const {
publishDate: rawPublishDate = new Date(),
@@ -57,7 +57,7 @@ const getNormalizedPost = async (post: CollectionEntry<'post'>): Promise<Post> =
metadata = {},
} = data;
const slug = cleanSlug(rawSlug); // cleanSlug(rawSlug.split('/').pop());
const slug = cleanSlug(id); // cleanSlug(rawSlug.split('/').pop());
const publishDate = new Date(rawPublishDate);
const updateDate = rawUpdateDate ? new Date(rawUpdateDate) : undefined;