feat(news): enhance SEO meta tags and add clarification article

- Update news detail page to use `useSeoMeta` for comprehensive Open Graph and Twitter Card support.
- Implement logic to prioritize `ogImage` and `seoTitle` with fallbacks to standard fields.
- Add new content article clarifying the distinction between the Alumni Association and the Alumni Liaison Office.
- Add documentation drafts for onboarding messages and announcement design.
This commit is contained in:
xiaomai
2025-11-28 11:54:11 +08:00
parent 9bca019b50
commit a28bb3a54d
4 changed files with 187 additions and 10 deletions

View File

@@ -18,16 +18,43 @@
</template>
<script lang="ts" setup>
const route = useRoute()
const { data: n } = await useAsyncData('new-detail', () =>
queryCollection('news')
.path(`/news/${route.params.slug}`)
.first()
)
const route = useRoute();
const { data: n } = await useAsyncData("new-detail", () =>
queryCollection("news").path(`/news/${route.params.slug}`).first()
);
useHead({
title: n.value?.title
})
if (n.value) {
// 1. 确定图片:优先用 ogImage没有就用 cover
const shareImage = n.value.ogImage || n.value.cover;
// 2. 确定标题和描述:优先用 seoTitle没有就用 title
const shareTitle = n.value.seoTitle || n.value.title;
const shareDesc = n.value.seoDescription || n.value.description;
// 3. 注入 SEO
useSeoMeta({
// 基础
title: shareTitle,
description: shareDesc,
// Open Graph (Facebook / WhatsApp)
ogTitle: shareTitle,
ogDescription: shareDesc,
ogImage: shareImage,
ogType: "article",
// Twitter Card
twitterCard: "summary_large_image",
twitterTitle: shareTitle,
twitterDescription: shareDesc,
twitterImage: shareImage,
});
// 如果你用了 nuxt-og-image 模块生成动态图
if (shareImage) {
defineOgImage({ url: shareImage });
}
}
</script>
<style></style>
<style></style>