feat!: front-matter `language` -> `lang`

This commit is contained in:
saicaca 2024-09-10 01:31:35 +08:00
parent 1399bd9bc7
commit 31af084f8a
3 changed files with 4 additions and 4 deletions

View File

@ -44,7 +44,7 @@ image: ''
tags: []
category: ''
draft: false
language: ''
lang: ''
---
`

View File

@ -9,7 +9,7 @@ const postsCollection = defineCollection({
image: z.string().optional().default(''),
tags: z.array(z.string()).optional().default([]),
category: z.string().optional().default(''),
language: z.string().optional().default(''),
lang: z.string().optional().default(''),
/* For internal use */
prevTitle: z.string().default(''),

View File

@ -41,11 +41,11 @@ const jsonLd = {
url: Astro.site,
},
datePublished: formatDateToYYYYMMDD(entry.data.published),
inLanguage: (entry.data.language ? entry.data.language.replace('_', '-') : siteConfig.lang.replace('_', '-')),
inLanguage: (entry.data.lang ? entry.data.lang.replace('_', '-') : siteConfig.lang.replace('_', '-')),
// TODO include cover image here
}
---
<MainGridLayout banner={entry.data.image} title={entry.data.title} description={entry.data.description} lang={entry.data.language}>
<MainGridLayout banner={entry.data.image} title={entry.data.title} description={entry.data.description} lang={entry.data.lang}>
<script is:inline slot="head" type="application/ld+json" set:html={JSON.stringify(jsonLd)}></script>
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative mb-4">
<div id="post-container" class:list={["card-base z-10 px-6 md:px-9 pt-6 pb-4 relative w-full ",