--- import { getCollection } from 'astro:content'; import Layout from '../../_components/sub-page-layout.astro'; import type { HeaderProps } from '../../_components/header'; import { getCraftRecords } from '../../_lib/catalog'; import { PREFIXED_LOCALES, getCopy, isLocale, localizeCategory, type Locale, } from '../../_lib/i18n'; import '../../globals.css'; import '../../sub-pages.css'; // Localized routing only generates the `craft` and `blog` listing pages. // Detail pages (individual posts, craft items, …) stay at canonical // English URLs to keep the static build bounded; the localized chrome // links straight to those canonical detail URLs. export async function getStaticPaths() { // The skills / systems / templates catalogs moved under `/plugins/*`. // Their old localized listings are now 301'd by `public/_redirects`, // so this catch-all only renders the localized `craft` and `blog` // listings. Plugins itself is generated via short-code wrappers under // `app/pages/[locale]/plugins/`, so it does NOT participate here. const paths = ['craft', 'blog']; return PREFIXED_LOCALES.flatMap((locale) => paths.map((path) => ({ params: { locale, path }, })), ); } const localeParam = Astro.params.locale; const locale: Locale = isLocale(localeParam) ? localeParam : 'en'; const copy = getCopy(locale); const pathParam = Astro.params.path ?? ''; const segments = pathParam.split('/').filter(Boolean); const [craft, posts] = await Promise.all([ getCraftRecords(), getCollection('blog'), ]); // All cross-locale subpage links resolve to canonical (English) URLs. const href = (path: string) => path; const titleSuffix = 'Open Design'; const routeRoot = segments[0] ?? ''; const sortedPosts = posts.sort((a, b) => b.data.date.getTime() - a.data.date.getTime()); const pageTitle = routeRoot === 'craft' ? `${copy.craftTitle} — ${craft.length} | ${titleSuffix}` : `${copy.blog} — ${titleSuffix}`; const pageDescription = `Open Design ${routeRoot || 'landing'} page.`; --- {routeRoot === 'blog' && ( <>
{copy.blog}

{copy.blog}.

Notes to help you understand, explore, and build with Open Design.

    {sortedPosts.map((post, index) => (
  1. {String(index + 1).padStart(2, '0')} {post.data.title} {post.data.summary} {localizeCategory(post.data.category, locale)}
  2. ))}
)} {routeRoot === 'craft' && ( <>
{copy.catalog} · Nº 03

{copy.craftTitle} — {craft.length} rendering principles.

Quality rules for accessibility, motion, color, type, and state coverage.

    {craft.map((item, index) =>
  1. {String(index + 1).padStart(2, '0')}{item.name}{item.summary}
  2. )}
)}