+
+ {webmentionsEnabled && }
+ {showComments && }
+
+
+ {webmentionsEnabled &&
+
+
}
+
+ {showComments && }
+}
+
+
+
+
diff --git a/src/components/TwikooClient.astro b/src/components/TwikooClient.astro
index 2159a87..7d14cea 100644
--- a/src/components/TwikooClient.astro
+++ b/src/components/TwikooClient.astro
@@ -39,6 +39,8 @@
const initCurrentComments = () => {
const root = document.querySelector('#twikoo-comments');
if (!(root instanceof HTMLElement) || root.dataset.twikooBound) return;
+ const panel = root.closest('[data-engagement-panel]');
+ if (panel instanceof HTMLElement && panel.hidden) return;
let config;
try {
config = JSON.parse(root.dataset.twikooConfig ?? '{}');
@@ -62,6 +64,7 @@
initCurrentComments();
document.addEventListener('astro:page-load', initCurrentComments);
+ document.addEventListener('engagement:tab-change', initCurrentComments);
document.addEventListener('astro:before-swap', () => {
document.querySelector('#twikoo-comments')?.replaceChildren();
});
diff --git a/src/components/TwikooComments.astro b/src/components/TwikooComments.astro
index 8a58b9f..1e8e98f 100644
--- a/src/components/TwikooComments.astro
+++ b/src/components/TwikooComments.astro
@@ -12,12 +12,12 @@ const config = comments.provider === 'twikoo' && comments.envId.trim() ? {
} : null;
---
{enabled && config && }
{enabled && !config &&
评论
+评论