feat(threads): add SEO metadata, sitemap, and structured data

Include /threads in sitemap and set canonical paths
Generate DiscussionForumPosting structured data for thread details
Add dynamic SEO updates for thread navigation and server-side rendering
This commit is contained in:
2026-05-07 13:46:08 +08:00
parent 520d988589
commit 4a7309027a
8 changed files with 92 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ import {
iconThreads,
iconUndo
} from '../icons';
import { applySeo, resolvedSeoHead, resolveSeo, threadSeoConfig } from '../seo';
import {
api,
threadWebSocketUrl,
@@ -158,6 +159,9 @@ const currentThreadList = computed(() => {
});
});
const detailModalOpen = computed(() => activeThread.value !== null);
const threadSeo = computed(() => (activeThread.value ? resolveSeo(threadSeoConfig(activeThread.value, t)) : null));
useHead(() => (threadSeo.value ? resolvedSeoHead(threadSeo.value) : {}));
const messageGroups = computed<MessageGroup[]>(() => {
const groups: MessageGroup[] = [];
@@ -826,6 +830,12 @@ watch(activeThreadId, async () => {
await loadMessages(true);
});
watch(activeThread, (thread) => {
if (thread) {
applySeo(threadSeoConfig(thread, t));
}
});
onMounted(() => {
void loadAll();
});