Rename blog collection as posts
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { z, defineCollection } from 'astro:content';
|
||||
|
||||
const blog = defineCollection({
|
||||
const posts = defineCollection({
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string().optional(),
|
||||
@ -23,5 +23,5 @@ const blog = defineCollection({
|
||||
});
|
||||
|
||||
export const collections = {
|
||||
blog: blog,
|
||||
posts: posts,
|
||||
};
|
||||
|
@ -102,7 +102,6 @@ const meta = {
|
||||
<Content
|
||||
highlight="Inside template"
|
||||
title="And what's inside? ..."
|
||||
content="Ne dicta praesent ocurreret has, diam theophrastus at pro. Eos etiam regione ut, persius eripuit quo id. Sit te euismod tacimates."
|
||||
items={[
|
||||
{
|
||||
title: 'Per ei quaeque sensibus',
|
||||
@ -124,7 +123,14 @@ const meta = {
|
||||
src: import('~/assets/images/caos.jpg'),
|
||||
alt: 'Colorful Image',
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<Fragment slot="content">
|
||||
<h3 class="text-2xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-3xl mb-2">
|
||||
Ad vix debet docendi
|
||||
</h3>
|
||||
Ne dicta praesent ocurreret has, diam theophrastus at pro. Eos etiam regione ut, persius eripuit quo id. Sit te euismod tacimates.
|
||||
</Fragment>
|
||||
</Content>
|
||||
|
||||
<!-- Content Widget **************** -->
|
||||
|
||||
|
@ -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))
|
||||
|
Reference in New Issue
Block a user