From 31af084f8a29ffbd7b195c6883354b7e4dfafbc9 Mon Sep 17 00:00:00 2001 From: saicaca Date: Tue, 10 Sep 2024 01:31:35 +0800 Subject: [PATCH] feat!: front-matter `language` -> `lang` --- scripts/new-post.js | 2 +- src/content/config.ts | 2 +- src/pages/posts/[...slug].astro | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/new-post.js b/scripts/new-post.js index 6f9f21e..f66a188 100644 --- a/scripts/new-post.js +++ b/scripts/new-post.js @@ -44,7 +44,7 @@ image: '' tags: [] category: '' draft: false -language: '' +lang: '' --- ` diff --git a/src/content/config.ts b/src/content/config.ts index 50e7d8b..aca0bff 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -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(''), diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 5025db6..34815a5 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -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 } --- - +