chore: tipoak konpontzen ditu
This commit is contained in:
1 parent
0f435de542
commit
270b7fa3e4
2 files changed
+13
-12
No files matched your search
+11
-10
@@ -1,17 +1,18 @@
|
|||||||
import { defineCollection, z } from "astro:content";
|
import { defineCollection } from "astro:content";
|
||||||
|
import { z } from "astro/zod";
|
||||||
|
|
||||||
import { glob } from "astro/loaders";
|
import { glob } from "astro/loaders";
|
||||||
|
|
||||||
const posts = defineCollection({
|
const posts = defineCollection({
|
||||||
loader: glob({ pattern: "*.md", base: "./posts" }),
|
loader: glob({ pattern: "*.md", base: "./posts" }),
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
slug: z.string(),
|
slug: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
added: z.union([z.string(), z.date()]),
|
added: z.union([z.string(), z.date()]),
|
||||||
updated: z.union([z.string(), z.date()]).optional(),
|
updated: z.union([z.string(), z.date()]).optional(),
|
||||||
tags: z.array(z.string()),
|
tags: z.array(z.string()),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const collections = { posts };
|
export const collections = { posts };
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
import { getCollection, render } from "astro:content";
|
import { CollectionEntry, getCollection, render } from "astro:content";
|
||||||
import BlogPost from "../../layouts/BlogPost.astro";
|
import BlogPost from "../../layouts/BlogPost.astro";
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
let posts = await getCollection("posts");
|
const posts: CollectionEntry<"posts">[] = await getCollection("posts");
|
||||||
|
|
||||||
return posts.map((post) => {
|
return posts.map((post) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in new issue
Block a user