Skip to content

Commit 6b06726

Browse files
authored
Merge pull request #32 from devwqc/develop
[release] develop to main
2 parents 0406e2a + a49377c commit 6b06726

10 files changed

Lines changed: 93 additions & 8 deletions

File tree

package-lock.json

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
},
2828
"dependencies": {
2929
"@astrojs/check": "^0.9.3",
30+
"@astrojs/rss": "4.0.7",
3031
"@astrojs/tailwind": "5.1.1",
3132
"astro": "^4.15.9",
3233
"tailwindcss": "3.4.13",

src/components/Footer.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@ const today = new Date();
2828
rel="noreferrer noopener">LinkedIn</SnsIcon
2929
>
3030
</li>
31+
<li>
32+
<SnsIcon href="/rss.xml" target="_blank" rel="noreferrer noopener"
33+
>RSS</SnsIcon
34+
>
35+
</li>
3136
</ul>
3237
</footer>

src/components/PostComments.astro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
3+
---
4+
5+
<section class="giscus mx-auto w-full"></section>
6+
7+
<script
8+
src="https://giscus.app/client.js"
9+
data-repo="devwqc/devwqc.github.io"
10+
data-repo-id="R_kgDOM5MFPQ"
11+
data-category="Blog Posts Comments"
12+
data-category-id="DIC_kwDOM5MFPc4Ci-uX"
13+
data-mapping="url"
14+
data-strict="0"
15+
data-reactions-enabled="1"
16+
data-emit-metadata="0"
17+
data-input-position="bottom"
18+
data-theme="light"
19+
data-lang="ko"
20+
crossorigin="anonymous"
21+
async></script>

src/content/blog/2024/10/hello-world.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'Hello World!'
33
description: 'Hello World!'
4-
publishedDate: '2024-10-01'
4+
pubDate: '2024-10-01'
55
---
66

77
## Hello World!를 작성하는 시점의 나

src/content/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const blogCollection = defineCollection({
55
schema: z.object({
66
title: z.string(),
77
description: z.string(),
8-
publishedDate: z.coerce.date(),
8+
pubDate: z.coerce.date(),
99
updatedDate: z.coerce.date().optional(),
1010
}),
1111
});

src/pages/blog/[...slug].astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import FormattedDate from '@/components/FormattedDate.astro';
33
import MarkDown from '@/components/Markdown.astro';
4+
import PostComments from '@/components/PostComments.astro';
45
import PageLayout from '@/layouts/PageLayout.astro';
56
import { getCollection, type CollectionEntry } from 'astro:content';
67
@@ -26,7 +27,7 @@ const { Content } = await post.render();
2627
<p class="text-gray-500">
2728
<span>
2829
작성일:
29-
<FormattedDate datetime={post.data.publishedDate} />
30+
<FormattedDate datetime={post.data.pubDate} />
3031
</span>
3132
{
3233
post.data.updatedDate && (
@@ -41,9 +42,11 @@ const { Content } = await post.render();
4142
<MarkDown>
4243
<Content />
4344
</MarkDown>
44-
<footer>
45+
<footer class="pb-10">
46+
<p>Issue on GitHub</p>
4547
<p>방문해 주셔서 감사합니다.</p>
4648
<p>오탈자, 잘못된 정보에 대해 말씀해 주시면 감사히 받겠습니다.</p>
4749
</footer>
50+
<PostComments />
4851
</article>
4952
</PageLayout>

src/pages/blog/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PageLayout from '@/layouts/PageLayout.astro';
44
import { getCollection } from 'astro:content';
55
66
const posts = (await getCollection('blog')).sort(
7-
(a, b) => b.data.publishedDate.valueOf() - a.data.publishedDate.valueOf()
7+
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
88
);
99
---
1010

@@ -22,7 +22,7 @@ const posts = (await getCollection('blog')).sort(
2222
<p class="text-gray-500 text-sm">
2323
<span>
2424
작성일:
25-
<FormattedDate datetime={post.data.publishedDate} />
25+
<FormattedDate datetime={post.data.pubDate} />
2626
</span>
2727
{post.data.updatedDate && (
2828
<span>

src/pages/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PageLayout from '@/layouts/PageLayout.astro';
44
import { getCollection } from 'astro:content';
55
66
const posts = (await getCollection('blog')).sort(
7-
(a, b) => b.data.publishedDate.valueOf() - a.data.publishedDate.valueOf()
7+
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
88
);
99
---
1010

@@ -22,7 +22,7 @@ const posts = (await getCollection('blog')).sort(
2222
<p class="text-gray-500 text-sm">
2323
<span>
2424
작성일:
25-
<FormattedDate datetime={post.data.publishedDate} />
25+
<FormattedDate datetime={post.data.pubDate} />
2626
</span>
2727
{post.data.updatedDate && (
2828
<span>

src/pages/rss.xml.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import rss from '@astrojs/rss';
2+
import type { APIContext } from 'astro';
3+
import { getCollection } from 'astro:content';
4+
5+
export async function GET(context: APIContext) {
6+
const posts = (await getCollection('blog')).sort(
7+
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
8+
);
9+
return rss({
10+
title: 'devwqc blog',
11+
description: '저의 경험을 이야기하는 블로그입니다.',
12+
site: context.site || 'https://devwqc.github.io/',
13+
items: posts.map((post) => ({
14+
...post.data,
15+
link: `/blog/${post.slug}/`,
16+
})),
17+
});
18+
}

0 commit comments

Comments
 (0)