26 lines
923 B
Plaintext
26 lines
923 B
Plaintext
|
|
---
|
||
|
|
// SEO 头(title/description/canonical/og)。description 缺席时省略对应标签
|
||
|
|
// (不渲染空 content 的 meta——Task 6 门禁③按"有则合规"检查)。
|
||
|
|
import type { SiteConfig } from '../lib/load-render-data'
|
||
|
|
import { canonicalUrl, pageTitle, type PageMeta } from '../lib/ui'
|
||
|
|
|
||
|
|
interface Props {
|
||
|
|
site: SiteConfig
|
||
|
|
page: PageMeta
|
||
|
|
}
|
||
|
|
|
||
|
|
const { site, page } = Astro.props
|
||
|
|
const title = pageTitle(site, page)
|
||
|
|
const url = canonicalUrl(site, page.path)
|
||
|
|
const description = page.description ?? ''
|
||
|
|
---
|
||
|
|
|
||
|
|
<title>{title}</title>
|
||
|
|
{description !== '' && <meta name="description" content={description} />}
|
||
|
|
<link rel="canonical" href={url} />
|
||
|
|
<meta property="og:title" content={title} />
|
||
|
|
{description !== '' && <meta property="og:description" content={description} />}
|
||
|
|
<meta property="og:url" content={url} />
|
||
|
|
<meta property="og:type" content="website" />
|
||
|
|
<meta property="og:site_name" content={site.name} />
|