buildmymcpserver/apps/web/app/templates/[slug]/collapsible-code.tsx
Marco Sadjadi 1349dc1dc0 @
feat(web): SEO — server-rendered template pages + /guides articles

- templates/[slug] converted from client to server component: per-template
  generateMetadata (title/description/canonical/OG) + SoftwareApplication
  JSON-LD; code-audit toggle split into a client island; missing/non-public
  templates now return a real 404.
- sitemap.ts pulls public template slugs live from the API (best-effort) +
  the new /guides routes.
- new /guides section: 3 server-rendered SEO articles (host MCP with OAuth,
  hosted-platforms comparison, MintMCP alternative) with TechArticle JSON-LD;
  Guides link added to the marketing nav.
- lib/seo.ts: articleJsonLd + templateJsonLd builders.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
2026-05-31 12:08:05 +02:00

35 lines
1.2 KiB
TypeScript

'use client';
import { CodeBlock } from '@/components/code-block';
import { ChevronDown, ChevronRight } from 'lucide-react';
import { useState } from 'react';
/**
* Client island: the "audit the generated code before you fork" toggle. Kept
* out of the server-rendered page so the page itself stays static + indexable.
*/
export function CollapsibleCode({ code }: { code: string }) {
const [show, setShow] = useState(false);
return (
<section className="mt-10">
<button
type="button"
onClick={() => setShow((s) => !s)}
className="inline-flex items-center gap-1 text-[14px] font-semibold tracking-tight text-[--color-fg] transition-colors hover:text-[--color-fg-muted]"
>
{show ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
Generated code ({code.length} chars)
</button>
<p className="mt-1 text-[12px] text-[--color-fg-muted]">
Audit before you fork. We re-scan every published template for banned patterns (eval,
child_process, prompt-injection markers).
</p>
{show && (
<div className="mt-3">
<CodeBlock label="src/server.ts" code={code} />
</div>
)}
</section>
);
}