feat: i18n rss url and different excerpt length for different languages

This commit is contained in:
radishzzz 2025-03-17 02:49:02 +00:00
parent e4c61bf21b
commit f34b0cb46b
6 changed files with 62 additions and 13 deletions

View file

@ -98,7 +98,7 @@ export async function getStaticPaths() {
}
const { post, lang, supportedLangs } = Astro.props
const description = generateDescription(post)
const description = generateDescription(post, 'meta')
const { Content, remarkPluginFrontmatter } = await post.render()
// 构建标签链接

View file

@ -1,3 +1,4 @@
import type { CollectionEntry } from 'astro:content'
import { generateDescription } from '@/utils/description'
import { OGImageRoute } from 'astro-og-canvas'
import { getCollection } from 'astro:content'
@ -7,11 +8,11 @@ const blogEntries = await getCollection('posts')
// Convert to page data objects
const pages = Object.fromEntries(
blogEntries.map(post => [
blogEntries.map((post: CollectionEntry<'posts'>) => [
post.slug,
{
title: post.data.title,
description: post.data.description || generateDescription(post),
description: post.data.description || generateDescription(post, 'og'),
},
]),
)