Rename blog collection as posts

This commit is contained in:
prototypa
2023-01-21 21:37:09 -05:00
parent b3dd2b5505
commit b1c6c91989
8 changed files with 12 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import type { CollectionEntry } from 'astro:content';
import type { Post } from '~/types';
import { cleanSlug } from './permalinks';
const getNormalizedPost = async (post: CollectionEntry<'blog'>): Promise<Post> => {
const getNormalizedPost = async (post: CollectionEntry<'posts'>): Promise<Post> => {
const { id, slug = '', data } = post;
const { Content, remarkPluginFrontmatter } = await post.render();
@ -28,7 +28,7 @@ const getNormalizedPost = async (post: CollectionEntry<'blog'>): Promise<Post> =
};
const load = async function (): Promise<Array<Post>> {
const posts = await getCollection('blog');
const posts = await getCollection('posts');
const normalizedPosts = posts.map(async (post) => await getNormalizedPost(post));
const results = (await Promise.all(normalizedPosts))