Files
mcpedia/apps/web/app/page.tsx
T
asepharyana 2d974b8952
CI / typecheck + build (turbo) (push) Canceled after 0s
fix(web): fix doubled section prefix in doc links (404 on click)
Home page, search results, and doc page Related links all
generated hrefs as /${section}/${slug} but slug already
includes the section prefix (e.g. 'docs/websocket/contract'),
producing doubled URLs like /docs/docs/websocket/contract → 404.
Fix: href={`/${d.slug}`} everywhere.
2026-08-20 12:33:35 +07:00

55 lines
1.8 KiB
TypeScript

import Link from "next/link";
import { listDocuments } from "@mcpedia/core";
import type { DocumentMeta } from "@mcpedia/core";
// Render at request time — content is in Postgres (not available at build in
// CI, which has no DB). Request-time rendering is instant at this corpus scale.
export const dynamic = "force-dynamic";
const SECTIONS = ["docs", "writeups", "research", "notes"] as const;
export default async function Home() {
const all = await listDocuments();
const bySection = SECTIONS.map((section) => ({
section,
docs: all.filter((d) => d.section === section),
}));
return (
<div className="space-y-8">
<section>
<h1 className="text-2xl font-semibold tracking-tight">MCPedia</h1>
<p className="mt-2 text-zinc-600 dark:text-zinc-400">
A content-first knowledge base. Humans read the Web UI; AI agents use
the MCP server. Both share one Core.
</p>
</section>
{bySection.map(({ section, docs }) => (
<section key={section}>
<h2 className="text-lg font-medium capitalize mb-2">{section}</h2>
{docs.length === 0 ? (
<p className="text-sm text-zinc-500">No documents yet.</p>
) : (
<ul className="divide-y divide-zinc-200 dark:divide-zinc-800">
{docs.map((d: DocumentMeta) => (
<li key={d.slug} className="py-2">
<Link
href={`/${d.slug}`}
className="hover:underline font-medium"
>
{d.title}
</Link>
<div className="text-xs text-zinc-500 mt-0.5">
{d.tags.map((t) => `#${t}`).join(" ")}
</div>
</li>
))}
</ul>
)}
</section>
))}
</div>
);
}