@ -1,8 +1,27 @@
|
||||
---
|
||||
import Layout from "@/layouts/Layout.astro"
|
||||
import Article from "@/components/pages/article.astro"
|
||||
import { fetchArticleById } from "@/lib/data"
|
||||
|
||||
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /article?id= 链接,无需改动其他页面)
|
||||
export const prerender = false
|
||||
|
||||
const API = (import.meta.env.API_SSR || import.meta.env.PUBLIC_API_BASE || "http://localhost:8090").replace(/\/$/, "")
|
||||
const id = Astro.url.searchParams.get("id")
|
||||
let article: import("@/lib/data").RawArticle | null = null
|
||||
let error: "missing" | "failed" | null = null
|
||||
if (!id) {
|
||||
error = "missing"
|
||||
} else {
|
||||
try {
|
||||
article = await fetchArticleById(id, API)
|
||||
} catch {
|
||||
article = null
|
||||
}
|
||||
error = article ? null : "failed"
|
||||
}
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<Article />
|
||||
<Article article={article} locale="en" apiBase={API} error={error} />
|
||||
</Layout>
|
||||
|
||||
@ -1,8 +1,27 @@
|
||||
---
|
||||
import Layout from "@/layouts/Layout.astro"
|
||||
import Article from "@/components/pages/article.astro"
|
||||
import { fetchArticleById } from "@/lib/data"
|
||||
|
||||
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /cn/article?id= 链接,无需改动其他页面)
|
||||
export const prerender = false
|
||||
|
||||
const API = (import.meta.env.API_SSR || import.meta.env.PUBLIC_API_BASE || "http://localhost:8090").replace(/\/$/, "")
|
||||
const id = Astro.url.searchParams.get("id")
|
||||
let article: import("@/lib/data").RawArticle | null = null
|
||||
let error: "missing" | "failed" | null = null
|
||||
if (!id) {
|
||||
error = "missing"
|
||||
} else {
|
||||
try {
|
||||
article = await fetchArticleById(id, API)
|
||||
} catch {
|
||||
article = null
|
||||
}
|
||||
error = article ? null : "failed"
|
||||
}
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<Article />
|
||||
<Article article={article} locale="cn" apiBase={API} error={error} />
|
||||
</Layout>
|
||||
|
||||
@ -1,8 +1,27 @@
|
||||
---
|
||||
import Layout from "@/layouts/Layout.astro"
|
||||
import Article from "@/components/pages/article.astro"
|
||||
import { fetchArticleById } from "@/lib/data"
|
||||
|
||||
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /en/article?id= 链接,无需改动其他页面)
|
||||
export const prerender = false
|
||||
|
||||
const API = (import.meta.env.API_SSR || import.meta.env.PUBLIC_API_BASE || "http://localhost:8090").replace(/\/$/, "")
|
||||
const id = Astro.url.searchParams.get("id")
|
||||
let article: import("@/lib/data").RawArticle | null = null
|
||||
let error: "missing" | "failed" | null = null
|
||||
if (!id) {
|
||||
error = "missing"
|
||||
} else {
|
||||
try {
|
||||
article = await fetchArticleById(id, API)
|
||||
} catch {
|
||||
article = null
|
||||
}
|
||||
error = article ? null : "failed"
|
||||
}
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<Article />
|
||||
<Article article={article} locale="en" apiBase={API} error={error} />
|
||||
</Layout>
|
||||
|
||||
@ -1,5 +1,27 @@
|
||||
---
|
||||
export const prerender = false;
|
||||
import Layout from "@/layouts/Layout.astro"
|
||||
import Article from "@/components/pages/article.astro"
|
||||
import { fetchArticleById } from "@/lib/data"
|
||||
|
||||
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /en/article?id= 链接,无需改动其他页面)
|
||||
export const prerender = false
|
||||
|
||||
const API = (import.meta.env.API_SSR || import.meta.env.PUBLIC_API_BASE || "http://localhost:8090").replace(/\/$/, "")
|
||||
const {id} = Astro.params
|
||||
let article: import("@/lib/data").RawArticle | null = null
|
||||
let error: "missing" | "failed" | null = null
|
||||
if (!id) {
|
||||
error = "missing"
|
||||
} else {
|
||||
try {
|
||||
article = await fetchArticleById(id, API)
|
||||
} catch {
|
||||
article = null
|
||||
}
|
||||
error = article ? null : "failed"
|
||||
}
|
||||
---
|
||||
|
||||
123123123
|
||||
<Layout>
|
||||
<Article article={article} locale="en" apiBase={API} error={error} />
|
||||
</Layout>
|
||||
|
||||
@ -3,5 +3,5 @@ import Layout from '@/layouts/Layout.astro'
|
||||
import RunwayLooks from '@/components/RunwayLooks.astro'
|
||||
---
|
||||
<Layout>
|
||||
|
||||
<RunwayLooks />
|
||||
</Layout>
|
||||
@ -24,7 +24,7 @@ if (!yearChips.length) yearChips = yearSeed
|
||||
---
|
||||
|
||||
<Layout title="All Shows — Portfolio Studio">
|
||||
<div class="showsroot w-full" x-data="showsPage()">
|
||||
<div class="showsroot w-full" x-data="showsPage()" data-locale={locale}>
|
||||
<!-- 顶部:极简眉头 -->
|
||||
<header class="showshead">
|
||||
<div>
|
||||
@ -190,7 +190,7 @@ if (!yearChips.length) yearChips = yearSeed
|
||||
|
||||
<!-- Card List -->
|
||||
<template x-for="it in items" :key="it.id">
|
||||
<a class="showscard" :href="`/article?id=${it.id}`" :aria-label="`${it.brand_name} ${it.title}`">
|
||||
<a class="showscard" :href="`/${localeUrl}?id=${it.id}`" :aria-label="`${it.brand_name} ${it.title}`">
|
||||
<div class="showscard-left">
|
||||
<div class="showscard-img" :class="{ 'is-loaded': it._imgLoaded }">
|
||||
<span class="showsspin" aria-hidden="true" x-html="SPIN_SVG"></span>
|
||||
@ -559,6 +559,7 @@ if (!yearChips.length) yearChips = yearSeed
|
||||
const allBrands: BrandEntry[] = node?.textContent ? JSON.parse(node.textContent) : []
|
||||
|
||||
return {
|
||||
localeUrl: this.dataset.locale,
|
||||
allBrands,
|
||||
ICON_USER,
|
||||
ICON_DATE,
|
||||
|
||||
Reference in New Issue
Block a user