chore: organize giscus-related configurations

This commit is contained in:
radishzzz 2025-05-30 12:59:00 +01:00
parent 4b270755bf
commit d12e235a23
8 changed files with 43 additions and 251 deletions

View file

@ -1,6 +1,6 @@
---
// import Disqus from '@/components/Comments/Disqus.astro'
import Giscus from '@/components/Comments/Giscus.astro'
// import Giscus from '@/components/Comments/Giscus.astro'
// import Twikoo from '@/components/Comments/Twikoo.astro'
import Waline from '@/components/Comments/Waline.astro'
import { themeConfig } from '@/config'
@ -9,22 +9,22 @@ const enableComments = themeConfig.comment?.enabled ?? false
// Disqus
// const disqusShortname = themeConfig.comment?.disqus?.shortname || ''
// const showDisqus = enableComments && themeConfig.comment.provider == 'disqus' && disqusShortname.trim() !== ''
// const showDisqus = enableComments && disqusShortname.trim() !== ''
Giscus
const giscusRepo = themeConfig.comment?.giscus?.repo || ''
const showGiscus = enableComments && themeConfig.comment.provider == 'giscus' && giscusRepo.trim() !== ''
// Giscus
// const giscusRepo = themeConfig.comment?.giscus?.repo || ''
// const showGiscus = enableComments && giscusRepo.trim() !== ''
// Twikoo
// const twikooEnvId = themeConfig.comment?.twikoo?.envId || ''
// const showTwikoo = enableComments && themeConfig.comment.provider == 'twikoo' && twikooEnvId.trim() !== ''
// const showTwikoo = enableComments && twikooEnvId.trim() !== ''
// Waline
const walineURL = themeConfig.comment?.waline?.serverURL || ''
const showWaline = enableComments && themeConfig.comment.provider == 'waline' && walineURL.trim() !== ''
const showWaline = enableComments && walineURL.trim() !== ''
---
<!-- {showDisqus && <Disqus />} -->
{showGiscus && <Giscus />}
<!-- {showGiscus && <Giscus />} -->
<!-- {showTwikoo && <Twikoo />} -->
{showWaline && <Waline />}