diff --git a/app/pages/events/[slug].vue b/app/pages/events/[slug].vue index fa2f477..8e18f3f 100644 --- a/app/pages/events/[slug].vue +++ b/app/pages/events/[slug].vue @@ -7,9 +7,13 @@ -
+
-
+
@@ -17,16 +21,32 @@ @@ -41,16 +61,43 @@ diff --git a/content.config.ts b/content.config.ts index 6e052a9..3b6bc4d 100644 --- a/content.config.ts +++ b/content.config.ts @@ -1,4 +1,5 @@ import { defineContentConfig, defineCollection, z } from "@nuxt/content"; +import { asSeoCollection } from "@nuxtjs/seo/content"; export default defineContentConfig({ collections: { @@ -12,29 +13,31 @@ export default defineContentConfig({ date: z.coerce.date(), location: z.string(), cover: z.string().url(), - draft: z.boolean().optional().default(false) + draft: z.boolean().optional().default(false), }), }), // 新闻集合 - news: defineCollection({ - type: "page", - source: "news/*.md", - schema: z.object({ - title: z.string(), - date: z.coerce.date(), - updated: z.coerce.date().optional(), - author: z.string(), - description: z.string(), - cover: z.string().optional(), - tags: z.array(z.string()).optional(), - category: z.enum(["活动", "通知", "招聘", "博客"]).optional(), - highlight: z.boolean().optional(), - seoTitle: z.string().optional(), - seoDescription: z.string().optional(), - ogImage: z.string().optional(), - draft: z.boolean().optional().default(false) - }), - }), + news: defineCollection( + asSeoCollection({ + type: "page", + source: "news/*.md", + schema: z.object({ + title: z.string(), + date: z.coerce.date(), + updated: z.coerce.date().optional(), + author: z.string(), + description: z.string(), + cover: z.string().optional(), + tags: z.array(z.string()).optional(), + category: z.enum(["活动", "通知", "招聘", "博客"]).optional(), + highlight: z.boolean().optional(), + seoTitle: z.string().optional(), + seoDescription: z.string().optional(), + ogImage: z.string().optional(), + draft: z.boolean().optional().default(false), + }), + }) + ), // 名人堂 hallOfFames: defineCollection({ type: "page", diff --git a/content/events/20251115-graduation-ceremony-60.md b/content/events/20251115-graduation-ceremony-60.md index 219557f..97d025e 100644 --- a/content/events/20251115-graduation-ceremony-60.md +++ b/content/events/20251115-graduation-ceremony-60.md @@ -17,35 +17,19 @@ keywords: - 刘连升老师 - 永中校友会 -# Open Graph / Facebook -og: - title: "永平中学第 60 届毕业典礼|初中第 67 届毕业典礼" - description: "2025 年永平中学毕业典礼隆重举行,包含师长致辞、奖学金颁发、荣休老师欢送,以及学生精彩演出等精彩环节。" - image: "https://img.yphsalumni.org/i/2025/11/27/st6hzt.jpg" - type: "article" +# --- SEO 专用字段 (对应你的 Zod Schema) --- -# Twitter 卡片 -twitter: - card: "summary_large_image" - title: "永平中学第 60 届毕业典礼" - description: "永平中学 2025 毕业典礼精彩回顾:致辞、演出、奖学金颁发与荣休教师表扬。" - image: "https://img.yphsalumni.org/i/2025/11/27/st6hzt.jpg" +# 对应 schema: seoTitle +# 如果不填,代码里会默认使用 title +seoTitle: "永平中学第 60 届毕业典礼|初中第 67 届毕业典礼" -# 文章结构化数据(可选,Nuxt SEO module 会自动识别) -structuredData: - "@type": "NewsArticle" - headline: "永平中学第 60 届毕业典礼圆满举行" - image: "https://img.yphsalumni.org/i/2025/11/27/st6hzt.jpg" - datePublished: "2025-11-15" - author: - "@type": "Organization" - name: "永平中学校友会" - publisher: - "@type": "Organization" - name: "永平中学" - logo: - "@type": "ImageObject" - url: "/logo.png" +# 对应 schema: seoDescription +# 如果不填,代码里会默认使用 description +seoDescription: "2025 年永平中学毕业典礼隆重举行,包含师长致辞、奖学金颁发、荣休老师欢送,以及学生精彩演出等精彩环节。" + +# 对应 schema: ogImage +# 只有当你想要分享的图片和封面图不一样时才填,否则代码里会默认用 cover +ogImage: "https://img.yphsalumni.org/i/2025/11/27/st6hzt.jpg" --- # 永平中学高中第 60 届、初中第 67 届毕业典礼圆满举行 diff --git a/nuxt.config.ts b/nuxt.config.ts index a031111..493691d 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -5,14 +5,15 @@ export default defineNuxtConfig({ compatibilityDate: "2025-07-15", devtools: { enabled: true }, modules: [ - "@nuxtjs/seo", "@nuxt/ui", + "@nuxtjs/seo", "@nuxt/content", "@nuxt/image", "reka-ui/nuxt", "@nuxtjs/robots", "@nuxtjs/sitemap", ], + ssr: true, css: ["~/assets/css/main.css"], vite: { plugins: [tailwindcss()],