feat: add giscus

This commit is contained in:
KazooTTT
2024-10-11 20:07:15 +08:00
parent d2f4fa5fec
commit 4fdafbe98a
11 changed files with 586 additions and 58 deletions

View File

@ -9,6 +9,7 @@ import Pagination from '@/components/Paginator.astro'
import PostPreview from '@/components/blog/PostPreview.astro'
import PageLayout from '@/layouts/BaseLayout.astro'
import { getAllPosts, getUniqueCategories, getUniqueTags, sortMDByDate } from '@/utils'
import GiscusComment from '@/components/GiscusComment'
export const getStaticPaths = (async ({ paginate }) => {
const allPosts = await getAllPosts()
@ -166,4 +167,5 @@ const paginationProps = {
)
}
</div>
<GiscusComment client:only='react' />
</PageLayout>

View File

@ -5,6 +5,7 @@ import type { GetStaticPaths, InferGetStaticPropsType } from 'astro'
import PostLayout from '@/layouts/BlogPost.astro'
import { getAllPosts } from '@/utils'
import GiscusComment from '@/components/GiscusComment'
export const getStaticPaths = (async () => {
const blogEntries = await getAllPosts()
@ -22,4 +23,5 @@ const { Content } = await entry.render()
<PostLayout post={entry}>
<Content />
<GiscusComment client:only='react' />
</PostLayout>

View File

@ -12,6 +12,7 @@ import kazootttAvatar from '../assets/kazoottt-avatar.jpeg'
import { getAllPosts, sortMDByDate } from '@/utils'
import { Icon } from 'astro-icon/components'
import GiscusComment from '@/components/GiscusComment'
const frontend = ['react(熟悉)', 'vue2(了解)', 'next.js', 'tailwindcss']
const backend = ['nodejs(熟悉)', 'python(了解)', 'elysiajs', 'nextjs', 'cloudflare d1', 'prisma']
@ -130,4 +131,5 @@ const allPostsByDate = sortMDByDate(allPosts).slice(0, MAX_POSTS)
</div>
</Section>
</div>
<GiscusComment client:only='react' />
</PageLayout>

View File

@ -2,6 +2,7 @@
import PageLayout from '@/layouts/BaseLayout.astro'
import ToolSection from '@/components/ToolSection.astro'
import Button from '@/components/Button.astro'
import GiscusComment from '@/components/GiscusComment'
const DESIGN = [
{
@ -112,4 +113,5 @@ const Divices = [
<ToolSection title='Devices' tools={Divices} />
</div>
</div>
<GiscusComment client:only='react' />
</PageLayout>