Refactor Client Portal Routing and Add Tooling Gallery Support
Summary
Refactored the
/client/[client]
and /client/[client]/essays/[...slug]
routes to use a shared layout with collapsible readers and YAML-driven ToolingGallery integration.Why Care
This update unifies the client-specific portal experience across both entry and deep-linked essay routes. It also adds dynamic gallery rendering from YAML configs, improving scalability and editing UX for client pages.
Implementation
Changes Made
- Unified
pages/client/[client].astro
andpages/client/[client]/essays/[...slug].astro
under a newClientPortalLayout.astro
component - Moved logic for loading essays, vocab/concepts, and current slug detection into shared layout
- Introduced
content/client/[client]/reference-terms.json
to drive dynamic reference term loading - Introduced
content/client/[client]/tooling-gallery.yaml
for YAML-configured ToolCard galleries - Updated
ToolingGallery.astro
component for collapsibility and tag/ID resolution - Fixed slug casing mismatches (Laerdal vs laerdal) with
.toLowerCase()
normalization - Added utility
capitalize()
function for display formatting
File Changes
text
content/client/laerdal/reference-terms.json
content/client/laerdal/tooling-gallery.yaml
src/components/client/ClientPortalLayout.astro
src/components/tool-components/ToolingGallery.astro
pages/client/[client].astro
pages/client/[client]/essays/[...slug].astro
Technical Details
YAML Parsing:
YAML file syntax such as:
yaml
- tag: [[Check It Out]]
- langchain-agent-toolkit
is parsed using regex to extract and normalize backlink-style tags and IDs.
Tool Resolution Logic:
Each tool ID or tag is resolved against
getCollection('tooling')
and deduplicated before rendering.Slug Matching:
Ensured
slug
matching accounts for trailing path segments: ts
const lastSlugSegment = Array.isArray(slug) ? slug.at(-1) : slug;
Integration Points
- Relies on
getReferenceSlug()
from@utils/slugify.ts
- Supports markdown
toolingGallery
code blocks parsed via customrehype
transformer - Compatible with client JSON + YAML configs
Documentation
components/tool-components/ToolingGallery.astro
now supports tag-based filtering via YAML- Client layouts use
ClientPortalLayout.astro
for SSR-compatible reference rendering - See
content/client/laerdal/tooling-gallery.yaml
for config examples