feat: add language as post property (#151)

* feat: add language as post property

* update frontmatter.json

* style: remove extra space

* fix: remove unnecessary replacements

* feat: add `language` field to `new-post.js`

* style: format code style

* fix: use `siteConfig.lang` in `jsonLd`

* fix: use `siteConfig` when `entry.data` was empty
This commit is contained in:
Alan Ye
2024-08-27 23:52:30 +08:00
committed by GitHub
parent 856c2bb2c0
commit f79ee3482d
6 changed files with 20 additions and 6 deletions

View File

@@ -21,9 +21,10 @@ interface Props {
title?: string
banner?: string
description?: string
lang?: string
}
let { title, banner, description } = Astro.props
let { title, banner, description, lang } = Astro.props
// apply a class to the body element to decide the height of the banner, only used for initial page load
// Swup can update the body for each page visit, but it's after the page transition, causing a delay for banner height change
@@ -52,7 +53,11 @@ if (title) {
const favicons: Favicon[] =
siteConfig.favicon.length > 0 ? siteConfig.favicon : defaultFavicons
const siteLang = siteConfig.lang.replace('_', '-')
// const siteLang = siteConfig.lang.replace('_', '-')
if (!lang) {
lang = `${siteConfig.lang}`
}
const siteLang = lang.replace('_', '-')
---
<!DOCTYPE html>