Skip to content

Commit 6c2a339

Browse files
committed
コンテンツ設定を更新し、記事コレクションのスキーマを追加。不要なファイルを削除し、次回の開催情報を表示するコンポーネントを追加。
1 parent e0a703f commit 6c2a339

5 files changed

Lines changed: 70 additions & 7 deletions

File tree

src/content.config.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// 1. Import utilities from `astro:content`
2+
import { defineCollection } from "astro:content";
3+
4+
// 2. Import loader(s)
5+
import { glob, file } from "astro/loaders";
6+
7+
// 3. Import Zod
8+
import { z } from "astro/zod";
9+
10+
const articleSchema = z.object({
11+
title: z.string(),
12+
author: z.string(),
13+
description: z.string().optional(),
14+
pubDate: z.coerce.date(),
15+
updatedDate: z.coerce.date().optional(),
16+
thumbnail: z.string().optional(),
17+
});
18+
19+
// 4. Define your collection(s)
20+
const about = defineCollection({
21+
loader: glob({ pattern: "**/*.md", base: "./src/content/about" }),
22+
schema: articleSchema,
23+
});
24+
25+
const article = defineCollection({
26+
loader: glob({
27+
pattern: "**/*.{md,mdx}",
28+
base: "./src/content/article",
29+
}),
30+
schema: articleSchema,
31+
});
32+
33+
const illust = defineCollection({
34+
loader: glob({
35+
pattern: "**/*.md",
36+
base: "./src/content/illust",
37+
}),
38+
schema: z.object({
39+
title: z.string(),
40+
date: z.coerce.date(),
41+
tags: z.array(z.string()).optional(),
42+
description: z.string().optional(),
43+
series: z.string().optional(),
44+
link: z.string().optional(),
45+
}),
46+
});
47+
48+
const onhourwritings = defineCollection({
49+
loader: glob({
50+
pattern: "**/*.md",
51+
}),
52+
});
53+
54+
const resources = defineCollection({});
55+
const templates = defineCollection({});
56+
57+
// 5. Export a single `collections` object to register your collection(s)
58+
export const collections = {
59+
about,
60+
article,
61+
illust,
62+
onhourwritings,
63+
resources,
64+
templates,
65+
};

src/content/about/links.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
2-
layout: "/src/layouts/Md.astro"
32
title: "記事2"
43
author: "uda2"
5-
date: "2000-01-01"
4+
pubDate: "2000-01-01"
65
description: "記事っす! 2"
76
---
87

src/content/about/profile.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
2-
layout: "/src/layouts/Md.astro"
32
title: "記事2"
43
author: "uda2"
5-
date: "2000-01-01"
4+
pubDate: "2000-01-01"
65
description: "記事っす! 2"
76
---
87

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
import Top from "../../layouts/Top.astro";
3-
import json from "../../data/onehourwriting/history.json";
4-
import { NextDay } from "./nextday";
2+
import Top from "../layouts/Top.astro";
3+
import json from "../data/onehourwriting/history.json";
4+
import { NextDay } from "../components/Onehourwriting/nextday.tsx";
55
---
66

77
<Top

0 commit comments

Comments
 (0)