mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-12 07:12:52 +01:00
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:
@@ -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>
|
||||
|
||||
@@ -11,15 +11,16 @@ interface Props {
|
||||
title?: string
|
||||
banner?: string
|
||||
description?: string
|
||||
lang?: string
|
||||
}
|
||||
|
||||
const { title, banner, description } = Astro.props
|
||||
const { title, banner, description, lang } = Astro.props
|
||||
const hasBannerCredit =
|
||||
siteConfig.banner.enable && siteConfig.banner.credit.enable
|
||||
const hasBannerLink = !!siteConfig.banner.credit.url
|
||||
---
|
||||
|
||||
<Layout title={title} banner={banner} description={description}>
|
||||
<Layout title={title} banner={banner} description={description} lang={lang}>
|
||||
<slot slot="head" name="head"></slot>
|
||||
<div class="max-w-[var(--page-width)] min-h-screen grid grid-cols-[17.5rem_auto] grid-rows-[auto_auto_1fr_auto] lg:grid-rows-[auto_1fr_auto]
|
||||
mx-auto gap-4 relative px-0 md:px-4"
|
||||
|
||||
Reference in New Issue
Block a user