Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
112 lines
4.2 KiB
TypeScript
112 lines
4.2 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
import { ApiError, getCreatorProfile } from "@/lib/api";
|
|
import type { CreatorProfile } from "@/lib/types";
|
|
import { SITE_URL, breadcrumbLd, graphDocument, personLd } from "@/lib/seo";
|
|
import { JsonLd } from "@/components/marketing/seo/JsonLd";
|
|
import { CreatorProfileClient } from "./CreatorProfileClient";
|
|
|
|
interface PageProps {
|
|
/** Next.js 15 passes dynamic route params as a Promise. May be a handle OR a user id. */
|
|
readonly params: Promise<{ handle: string }>;
|
|
}
|
|
|
|
/**
|
|
* PUBLIC creator profile (`/creators/{handle}`) — `GET /creators/{handleOrId}`
|
|
* is an unauthenticated, SAFE-DTO endpoint (see `lib/api.ts:getCreatorProfile`),
|
|
* so this page fetches it server-side for `generateMetadata` and a Person
|
|
* JSON-LD node, then hands the result to {@link CreatorProfileClient} for the
|
|
* follow/unfollow interactivity. Previously this whole page was a
|
|
* `"use client"` shell with no server-rendered content, no metadata and no
|
|
* structured data — every visit (crawler included) saw an empty div until
|
|
* JS hydrated and fetched the profile client-side.
|
|
*/
|
|
async function loadProfile(handleOrId: string): Promise<CreatorProfile | null> {
|
|
if (!handleOrId) return null;
|
|
try {
|
|
return await getCreatorProfile(handleOrId);
|
|
} catch (err) {
|
|
if (err instanceof ApiError && err.status === 404) return null;
|
|
// Any other failure (network, 5xx) degrades to the client component's own
|
|
// fetch + error state rather than failing the whole page at build/request time.
|
|
return null;
|
|
}
|
|
}
|
|
|
|
function profileDescription(profile: CreatorProfile): string {
|
|
const bio = profile.bio.trim();
|
|
if (bio) return bio;
|
|
return `${profile.display_name || profile.handle} on Menivor: ${profile.published_template_count} published template${profile.published_template_count === 1 ? "" : "s"}, ${profile.follower_count} follower${profile.follower_count === 1 ? "" : "s"}.`;
|
|
}
|
|
|
|
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
|
const { handle } = await params;
|
|
const decoded = decodeURIComponent(handle);
|
|
const profile = await loadProfile(decoded);
|
|
|
|
if (!profile) {
|
|
return {
|
|
title: "Creator profile",
|
|
robots: { index: false, follow: true },
|
|
};
|
|
}
|
|
|
|
const name = profile.display_name || profile.handle || "Menivor creator";
|
|
const description = profileDescription(profile);
|
|
const path = `/creators/${encodeURIComponent(profile.handle || decoded)}`;
|
|
|
|
return {
|
|
title: `${name} on Menivor`,
|
|
description,
|
|
alternates: { canonical: path },
|
|
// A creator with no published templates yet has nothing to rank for;
|
|
// keep the URL crawlable (`follow`) without indexing a thin profile.
|
|
robots: profile.published_template_count > 0 ? undefined : { index: false, follow: true },
|
|
openGraph: {
|
|
type: "profile",
|
|
url: `${SITE_URL}${path}`,
|
|
siteName: "Menivor",
|
|
title: `${name} on Menivor`,
|
|
description,
|
|
},
|
|
twitter: {
|
|
card: "summary",
|
|
title: `${name} on Menivor`,
|
|
description,
|
|
},
|
|
};
|
|
}
|
|
|
|
export default async function CreatorProfilePage({ params }: PageProps) {
|
|
const { handle } = await params;
|
|
const creatorRef = decodeURIComponent(handle);
|
|
const profile = await loadProfile(creatorRef);
|
|
|
|
if (!creatorRef) notFound();
|
|
|
|
const jsonLd = profile
|
|
? graphDocument([
|
|
breadcrumbLd([
|
|
{ name: "Home", path: "/" },
|
|
{ name: profile.display_name || profile.handle, path: `/creators/${encodeURIComponent(profile.handle || creatorRef)}` },
|
|
]),
|
|
personLd({
|
|
name: profile.display_name || profile.handle,
|
|
description: profileDescription(profile),
|
|
path: `/creators/${encodeURIComponent(profile.handle || creatorRef)}`,
|
|
stats: [
|
|
{ interactionType: "https://schema.org/FollowAction", userInteractionCount: profile.follower_count },
|
|
{ interactionType: "https://schema.org/CreateAction", userInteractionCount: profile.published_template_count },
|
|
],
|
|
}),
|
|
])
|
|
: null;
|
|
|
|
return (
|
|
<>
|
|
{jsonLd ? <JsonLd data={jsonLd} /> : null}
|
|
<CreatorProfileClient creatorRef={creatorRef} initialProfile={profile} />
|
|
</>
|
|
);
|
|
}
|