- {article.title} -
+ @@ -55,28 +47,36 @@ const body = article.description.split("\n\n"){p}
)} +diff --git a/src/components/LanguageDetector.astro b/src/components/LanguageDetector.astro new file mode 100644 index 0000000..60d587f --- /dev/null +++ b/src/components/LanguageDetector.astro @@ -0,0 +1,36 @@ +--- +import { pathHasLocale, getRelativeLocaleUrl } from 'astro:i18n'; + +// 使用 pathHasLocale 安全判断当前路径是否已包含任何语言前缀(返回 boolean) +const hasLocale = pathHasLocale(Astro.url.pathname); + +// 自动生成中文根路径 +const cnRootUrl = getRelativeLocaleUrl('cn', ''); +--- + + \ No newline at end of file diff --git a/src/components/pages/article.astro b/src/components/pages/article.astro index 875075c..df76420 100644 --- a/src/components/pages/article.astro +++ b/src/components/pages/article.astro @@ -1,53 +1,45 @@ ---- + + -// 示例数据:字段严格对齐后端 BrandRunway 模型 + 图片集接口 -const article = { - id: 1, - title: "Maison Lumen — Paper Light", - description: - "巴黎,2026 秋冬。Maison Lumen 以“Paper Light(纸光)”为题,将薄纱、宣纸与压褶工艺叠合成一种近乎透明的体积感。\n\n系列延续了工作室对“轻”的执念:肩线被刻意放低,廓形在行走中随风摆动,像被光穿透的纸。色彩仅保留骨白、炭灰与一抹雾蓝。\n\n这不是关于廓形的宣言,而是关于 material 的克制——用最少的手段,制造最大的呼吸感。", - created_at: 1711948800, - updated_at: 1711948800, - year: 2026, - source_url: "https://example.com/runway/maison-lumen-paper-light", - brand_id: 12, - brand_name: "Maison Lumen", - images: [ - { id: 1, image: "https://picsum.photos/seed/art1/1200/1500", name: "Look 01", sort_order: 1 }, - { id: 2, image: "https://picsum.photos/seed/art2/1200/1500", name: "Look 02", sort_order: 2 }, - { id: 3, image: "https://picsum.photos/seed/art3/1200/1500", name: "Look 03", sort_order: 3 }, - { id: 4, image: "https://picsum.photos/seed/art4/1200/1500", name: "Look 04", sort_order: 4 }, - ], -} +
{p}
)} +