feat: use banner as the key

This commit is contained in:
KazooTTT
2025-02-03 17:28:53 +08:00
parent 76f4deaf69
commit c78c373b82
5 changed files with 9 additions and 9 deletions

View File

@ -8,12 +8,12 @@ import { siteConfig } from '@/site-config'
type Props = SiteMeta
import { ViewTransitions } from 'astro:transitions'
const { articleDate, description, ogImage, title } = Astro.props
const { articleDate, description, banner, title } = Astro.props
const titleSeparator = '•'
const siteTitle = `${title} ${titleSeparator} ${siteConfig.title}`
const canonicalURL = new URL(Astro.url.pathname, Astro.site)
const socialImageURL = new URL(ogImage ? ogImage : '/social-card.png', Astro.url).href
const socialImageURL = new URL(banner ? banner : '/social-card.png', Astro.url).href
---
<meta charset='utf-8' />

View File

@ -20,7 +20,7 @@ const post = defineCollection({
.union([z.array(z.string()), z.null()])
.default([])
.transform(removeDupsAndLowerCase),
ogImage: z.string().optional(),
banner: z.string().optional(),
category: z.string().optional().nullable(),
finished: z.boolean().default(false),
pinned: z.boolean().default(false),

View File

@ -7,7 +7,7 @@ author: KazooTTT
type: Post
status: Published
tags:
- "2024"
- '2024'
- 年度总结
- 生活记录
- 职业发展
@ -22,7 +22,7 @@ noteId_x: 18
create_time: 12/30/2024, 5:18:07 PM
update_time: 1/30/2025, 9:18:33 PM
publish_time: 1/30/2025, 9:18:16 PM
ogImage: "https://pictures.kazoottt.top/2025/01/20250130-Pasted%20image%2020250130212038.png"
banner: 'https://pictures.kazoottt.top/2025/01/20250130-Pasted%20image%2020250130212038.png'
---
## 去年目标完成情况

View File

@ -13,13 +13,13 @@ interface Props {
}
const {
meta: { articleDate, description = siteConfig.description, ogImage, title }
meta: { articleDate, description = siteConfig.description, banner, title }
} = Astro.props
---
<html lang={siteConfig.lang} class=''>
<head>
<BaseHead articleDate={articleDate} description={description} ogImage={ogImage} title={title} />
<BaseHead articleDate={articleDate} description={description} banner={banner} title={title} />
</head>
<body class='flex justify-center bg-background'>

View File

@ -15,11 +15,11 @@ interface Props {
const { post, simple = false, backHref = '/blog' } = Astro.props
const {
data: { description, ogImage, title, date },
data: { description, banner, title, date },
slug
} = post
const socialImage = ogImage ? ogImage : undefined
const socialImage = banner ? ogImage : undefined
const articleDate = date?.toISOString()
const { headings } = await post.render()
---