open-design/apps/landing-page/app/_components/system-card.astro
Joey-nexu b0b2067e5c feat(landing-page): point catalog links at /plugins, drop legacy /skills /systems routes
The 2026-05 plugins rebuild left three homepage/library surfaces still
pointing at the retired `/skills/`, `/systems/`, and `/craft/` route
trees, so visitors hit a 301 hop (or a stale facet) instead of landing
directly on the new `/plugins/*` pages. Repoint them at the canonical
destinations and align the homepage Labs pills with the real library.

- system-card: link straight to `/plugins/design-system-<slug>/` via a
  new `detailHrefForSystemSlug` resolver instead of hard-coding
  `/systems/<slug>/` and relying on the redirect. The ~8 systems that
  ship no manifest (hence no detail page) degrade to `/plugins/systems/`,
  the same destination the legacy 301 produced, minus the hop and with no
  risk of linking at a page that doesn't exist.
- homepage Labs pills: replace the hard-coded prototype/deck/mobile/office
  facets (mobile/office had drifted to stale or empty counts) with a live
  top-4 of `PLUGIN_CATEGORIES`, counted with the same `categorizePlugin`
  rule `/plugins/templates/` uses and labelled from `pcopy.category`, so
  the homepage stays in lockstep with the library and never shows a dead
  chip. Counts are surfaced through a new `CatalogCounts.templateCategories`.
- remove the Craft entry points from the homepage footer, sub-page footer,
  header Library dropdown, and the plugins hub tile grid. The `/craft/`
  pages stay live; they're just no longer surfaced in site chrome.

The legacy `/skills/`, `/systems/`, `/templates/` 301s added in the prior
PR stay in place for inbound links and search equity.
2026-05-31 19:45:54 +08:00

43 lines
1.5 KiB
Text

---
/*
* Shared system card used on `/plugins/systems/`. Displays palette
* swatches, name, category, and tagline as a clickable card.
*
* The card links straight to the bundled-plugin detail page
* (`/plugins/design-system-<slug>/`) for the 142 systems that ship a
* manifest, and degrades to the `/plugins/systems/` index for the ~8
* that don't. `detailHrefForSystemSlug` resolves that mapping against
* the real detail-page set so we never link at a page that doesn't
* exist — same destinations the legacy `/systems/<slug>/` 301s produced,
* minus the redirect hop.
*/
import type { SystemRecord } from '../_lib/catalog';
import { detailHrefForSystemSlug } from '../_lib/bundled-plugins';
import { localeFromPath, localizedHref } from '../i18n';
export interface Props {
system: SystemRecord;
}
const { system } = Astro.props;
const locale = localeFromPath(Astro.url.pathname);
const href = (path: string) => localizedHref(path, locale);
const detailHref = detailHrefForSystemSlug(system.slug) ?? '/plugins/systems/';
---
<li class="system-card">
<a href={href(detailHref)}>
<div class="system-swatches" aria-hidden="true">
{system.palette.length > 0 ? (
system.palette.slice(0, 4).map((hex) => (
<span class="swatch" style={`background:${hex}`} />
))
) : (
<span class="swatch placeholder" />
)}
</div>
<span class="system-name">{system.name}</span>
<span class="system-cat">{system.categoryLabel}</span>
{system.tagline && <p class="system-tagline">{system.tagline}</p>}
</a>
</li>