buildmymcpserver/apps/web/app/sitemap.ts
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

54 lines
2.4 KiB
TypeScript

import { SITE_URL } from '@/lib/seo';
import { fetchPublicTemplateSlugs } from '@/lib/templates-server';
import type { MetadataRoute } from 'next';
type Entry = {
path: string;
priority: number;
changeFrequency: MetadataRoute.Sitemap[number]['changeFrequency'];
};
const ROUTES: Entry[] = [
{ path: '/', priority: 1.0, changeFrequency: 'weekly' },
{ path: '/pricing', priority: 0.9, changeFrequency: 'weekly' },
{ path: '/templates', priority: 0.9, changeFrequency: 'daily' },
{ path: '/guides', priority: 0.8, changeFrequency: 'weekly' },
{ path: '/guides/host-mcp-server-with-oauth', priority: 0.8, changeFrequency: 'monthly' },
{ path: '/guides/hosted-mcp-platforms-compared', priority: 0.8, changeFrequency: 'monthly' },
{ path: '/guides/mintmcp-alternative', priority: 0.7, changeFrequency: 'monthly' },
{ path: '/docs', priority: 0.8, changeFrequency: 'weekly' },
{ path: '/docs/concepts', priority: 0.7, changeFrequency: 'monthly' },
{ path: '/docs/oauth', priority: 0.7, changeFrequency: 'monthly' },
{ path: '/docs/authoring', priority: 0.7, changeFrequency: 'monthly' },
{ path: '/docs/api-reference', priority: 0.7, changeFrequency: 'monthly' },
{ path: '/docs/self-hosting', priority: 0.7, changeFrequency: 'monthly' },
{ path: '/docs/faq', priority: 0.6, changeFrequency: 'monthly' },
{ path: '/changelog', priority: 0.6, changeFrequency: 'weekly' },
{ path: '/security', priority: 0.5, changeFrequency: 'monthly' },
{ path: '/status', priority: 0.4, changeFrequency: 'weekly' },
{ path: '/privacy', priority: 0.3, changeFrequency: 'yearly' },
{ path: '/terms', priority: 0.3, changeFrequency: 'yearly' },
];
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const now = new Date();
const staticEntries: MetadataRoute.Sitemap = ROUTES.map((r) => ({
url: `${SITE_URL}${r.path}`,
lastModified: now,
changeFrequency: r.changeFrequency,
priority: r.priority,
}));
// Marketplace templates — each public template is its own indexable page.
// Best-effort: if the API is unreachable the static entries still ship.
const slugs = await fetchPublicTemplateSlugs();
const templateEntries: MetadataRoute.Sitemap = slugs.map((slug) => ({
url: `${SITE_URL}/templates/${slug}`,
lastModified: now,
changeFrequency: 'weekly',
priority: 0.6,
}));
return [...staticEntries, ...templateEntries];
}