← Files WixARCHIVED FILE
skills/wix-headless-templates/portfolio/project/src/pages/portfolio/[slug].astro
1.26 KB · Oct 8, 2026 · 12:02 UTC
---
// Collection page — header + its projects, resolved by slug SERVER-SIDE.
// Portfolio has no documented Wix SEO item type, so this page carries plain
// <title>/<meta description> from the DTO (no wixMetadata / <SEO.Tags> — unlike
// storefront/bookings item pages). Keep the frontmatter; swap the island import to YOUR
// collection-page component.
import SiteLayout from "../../layouts/SiteLayout.astro";
import CollectionProjectsView from "../../components/portfolio/CollectionProjectsView";
import { fetchCollectionBySlug, fetchProjects } from "../../wix/portfolio/portfolio";
import type { CollectionSummary, ProjectSummary } from "../../wix/portfolio/types";
const slug = Astro.params.slug!;
let collection: CollectionSummary | null = null;
let projects: ProjectSummary[] = [];
try {
collection = await fetchCollectionBySlug(slug);
if (collection) projects = await fetchProjects({ collectionId: collection.id });
} catch {
// Guarded: an unhandled SSR throw truncates the response mid-stream.
}
if (!collection) {
return new Response(null, { status: 404 });
}
---
<SiteLayout title={collection.title} description={collection.description}>
<CollectionProjectsView client:load slug={slug} initialCollection={collection} initialProjects={projects} />
</SiteLayout>
SHA-256: 2bc3edba4f8c78ae58e4195c3c776c544086a68b8400581aa8d4b398db9ec705