--- // /en/ 首页:与 zh 版结构逐区对齐(名片区/文章列表/最新影像/热力图/项目墙) import { Image } from 'astro:assets'; import { getCollection } from 'astro:content'; import BaseLayout from '../../layouts/BaseLayout.astro'; import IdCard from '../../components/IdCard.astro'; import PostList from '../../components/PostList.astro'; import ProjectWall from '../../components/geek/ProjectWall.astro'; import Heatmap from '../../components/geek/Heatmap.astro'; import { t } from '../../i18n/ui'; import { homeConfig, homeTagline, pageTypography, renderMarkdown, renderRich } from '../../lib/site-content'; import SocialLinks from '../../components/SocialLinks.astro'; // 首页可配项(后台主页设置):副标题/影像张数/区块开关/每轨条数,字段级回落 const cfg = await homeConfig('en'); const subtitleHtml = cfg.subtitle ? await renderMarkdown(cfg.subtitle) : ''; const posts = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden'))).sort( (a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(), ); // 列表标题吃 postsEn 译题(缺译回退 zh,与 /en/archives 同策略) const enTitle = Object.fromEntries( (await getCollection('postsEn')).map((e) => [e.id, e.data.title]), ); const photos = (await getCollection('photos')).slice(0, Math.max(1, cfg.latestPhotos)); // 身份语与 zh 版同源(content/site/home.yaml 的 en 字段),缺值回落默认 const tagline = await homeTagline('en'); const taglineHtml = await renderRich(tagline, { inline: true }); const typo = await pageTypography('siteHome', 'home'); ---

{subtitleHtml &&

} {cfg.sections.tracks && } {cfg.sections.photos && cfg.latestPhotos > 0 && (
{t('latest_photos', 'en')} {t('enter_gallery', 'en')}
{photos.map((photo) => ( {photo.data.alt ))}
)} {cfg.sections.heatmap && } {cfg.sections.projects && }