把giscus评论系统改成twikoo
This commit is contained in:
1 parent
676f05d861
commit
beb0b9e640
5 files changed
+61
-16
No files matched your search
@@ -0,0 +1,19 @@
|
||||
---
|
||||
import { commentConfig } from '@/config'
|
||||
|
||||
interface Props {
|
||||
path: string
|
||||
}
|
||||
|
||||
const config = {
|
||||
...commentConfig.twikoo,
|
||||
el: '#tcomment',
|
||||
path: Astro.props.path,
|
||||
}
|
||||
---
|
||||
|
||||
<div id="tcomment"></div>
|
||||
<script is:inline src="https://cdn.staticfile.org/twikoo/1.6.44/twikoo.all.min.js"></script>
|
||||
<script is:inline define:vars={{ config }}>
|
||||
twikoo.init(config)
|
||||
</script>
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
import type { CollectionEntry } from 'astro:content'
|
||||
import { commentConfig } from '@/config'
|
||||
import Twikoo from './Twikoo.astro'
|
||||
interface Props {
|
||||
post: CollectionEntry<'posts'>
|
||||
}
|
||||
|
||||
const { id, data, slug } = Astro.props.post
|
||||
|
||||
const path = `/posts/${slug}`
|
||||
const url = `${Astro.site?.href}${path}`
|
||||
|
||||
let commentService = ''
|
||||
if (commentConfig?.twikoo) {
|
||||
commentService = 'twikoo'
|
||||
}
|
||||
---
|
||||
<div class="card-base p-6 mb-4">
|
||||
{commentService === 'twikoo' && <Twikoo path={path} />}
|
||||
{commentService === '' && null}
|
||||
</div>
|
||||
Reference in new issue
Block a user