update
This commit is contained in:
@ -1,17 +1,37 @@
|
||||
---
|
||||
import '@/styles/global.css'
|
||||
import LoadingScreen from '@/components/LoadingScreen.astro'
|
||||
import LoadingOverlay from '@/components/LoadingOverlay.astro'
|
||||
import AuthModal from '@/components/AuthModal.astro'
|
||||
import { href, ROUTES } from '@/lib/routes'
|
||||
import { getI18n, LOCALE_NAMES, setApiLocale } from '@/lib/i18n'
|
||||
import { config } from '@/lib/config'
|
||||
import { i18n } from 'astro:config/client';
|
||||
import { toCodes } from 'astro:i18n';
|
||||
|
||||
const { title } = Astro.props as { title?: string }
|
||||
const siteTitle = title ? `${title} — Portfolio Studio` : "Portfolio Studio"
|
||||
interface Props {
|
||||
title?: string
|
||||
description?: string
|
||||
keywords?: string
|
||||
}
|
||||
const { title, description, keywords } = Astro.props
|
||||
|
||||
const { locale, t, getRelativeLocaleUrl } = getI18n(Astro)
|
||||
|
||||
const SITE_NAME = config.siteName ?? "Xisoa"
|
||||
const siteTitle = title ? `${title} — ${SITE_NAME}` : SITE_NAME
|
||||
|
||||
// 默认 TDK(按语言);各页面可经 Layout 的 description/keywords 覆盖。
|
||||
const defaultDescription =
|
||||
locale === 'cn'
|
||||
? `${SITE_NAME} 时尚档案收录全球时装周走秀造型与街头抓拍,可按品牌、季节、城市检索。`
|
||||
: `${SITE_NAME} is a fashion archive of runway looks and street style snaps — browse by brand, season and city.`
|
||||
const defaultKeywords =
|
||||
locale === 'cn'
|
||||
? "时尚档案,走秀,街拍,时装周,品牌,季节"
|
||||
: "fashion archive,runway looks,street style,fashion week,brand,season"
|
||||
const metaDescription = description ?? defaultDescription
|
||||
const metaKeywords = keywords ?? defaultKeywords
|
||||
|
||||
// 把当前语言注入 API 请求层:所有服务端(SSG/SSR)取数统一带上 ?locale=,
|
||||
// 后端据此选 *_en / *_cn 列。客户端 fetch 则自行按 URL path 推断,无需此处。
|
||||
setApiLocale(locale)
|
||||
@ -60,15 +80,18 @@ const headers = {
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{siteTitle}</title>
|
||||
<meta name="description" content={metaDescription} />
|
||||
<meta name="keywords" content={metaKeywords} />
|
||||
</head>
|
||||
<body class="bg-white text-black min-h-screen flex flex-col p-[30px_50px] font-sans">
|
||||
|
||||
<!-- 加载动画屏:独立组件,标记/样式/隐藏逻辑封装在 LoadingScreen.astro -->
|
||||
<LoadingScreen />
|
||||
<LoadingOverlay />
|
||||
|
||||
<!-- 顶部主导航栏 -->
|
||||
<nav class="flex justify-between items-center text-[13px] font-bold tracking-[0.5px] uppercase">
|
||||
<div class="flex flex-wrap items-center gap-6 md:gap-8">
|
||||
<a href={href(locale, ROUTES.home)} class="relative pb-[2px] cursor-pointer hover:opacity-60 transition-opacity duration-200">{t('Home')}</a>
|
||||
<a href={href(locale, ROUTES.home)} class="relative pb-[2px] cursor-pointer transition-opacity duration-200 flex items-center gap-1.5 hover:opacity-60 opacity-80 border-b-2 border-transparent">
|
||||
{t('Portfolio')}
|
||||
<span class="text-[10px] bg-black text-white px-1.5 py-0.5 rounded-full font-mono tracking-tight leading-none">
|
||||
|
||||
Reference in New Issue
Block a user