From 783fb958d506c20469598325b0caaa7b9a515724 Mon Sep 17 00:00:00 2001 From: radishzzz Date: Sat, 22 Mar 2025 04:30:25 +0000 Subject: [PATCH] feat: adjust layout spacing and add comment toggle configuration --- src/components/Comments/index.astro | 10 ++++++---- src/config.ts | 2 ++ src/layouts/Layout.astro | 9 ++++----- src/pages/[...index].astro | 4 ++-- src/types/index.d.ts | 3 ++- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/Comments/index.astro b/src/components/Comments/index.astro index ea9e47c..89321f8 100644 --- a/src/components/Comments/index.astro +++ b/src/components/Comments/index.astro @@ -5,21 +5,23 @@ import Waline from '@/components/Comments/Waline.astro' import { themeConfig } from '@/config' +const enableComments = themeConfig.comment?.enabled ?? false + // Disqus // const disqusShortname = themeConfig.comment?.disqus?.shortname || '' -// const showDisqus = disqusShortname.trim() !== '' +// const showDisqus = enableComments && disqusShortname.trim() !== '' // Giscus // const giscusRepo = themeConfig.comment?.giscus?.repo || '' -// const showGiscus = giscusRepo.trim() !== '' +// const showGiscus = enableComments && giscusRepo.trim() !== '' // Twikoo // const twikooEnvId = themeConfig.comment?.twikoo?.envId || '' -// const showTwikoo = twikooEnvId.trim() !== '' +// const showTwikoo = enableComments && twikooEnvId.trim() !== '' // Waline const walineURL = themeConfig.comment?.waline?.serverURL || '' -const showWaline = walineURL.trim() !== '' +const showWaline = enableComments && walineURL.trim() !== '' --- diff --git a/src/config.ts b/src/config.ts index 27466b4..367b3cc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -68,6 +68,8 @@ export const themeConfig: ThemeConfig = { // COMMENT SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START comment: { + // enable comment system + enabled: true, // true, false // waline comment system // https://waline.js.org/en/ waline: { diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index ec09e5a..e1cbde6 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -22,6 +22,9 @@ const { getLocalizedPath, isPost } = getPageInfo(Astro.url.pathname) const localizedHome = getLocalizedPath('/') const { light: { background: lightMode }, dark: { background: darkMode } } = themeConfig.color const fontStyle = themeConfig.global.fontStyle === 'serif' ? 'font-serif' : 'font-sans' +const MarginBottom = isPost && themeConfig.comment?.enabled + ? 'mb-10' // Post page with comment system + : 'mb-12' // Other pages ---
-
+