feat(seo): improve SEO configuration and enable SSR
- Enable `ssr: true` in `nuxt.config.ts` for server-side rendering of meta tags. - Implement `useSeoMeta` in `events/.vue` with fallback logic for Open Graph and Twitter cards. - Update `content.config.ts` to use `asSeoCollection` for the news collection. - Migrate event markdown frontmatter to use standardized SEO fields.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user