mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-02 01:34:48 +00:00
seo: give every page its own social title, not the homepage's (#203)
Reddit, Slack, X and Facebook read og:title, and every page of
logicsrc.com was serving the homepage's. The <title> tag was correct per
page, which is why it went unnoticed: Next.js shallow-merges metadata, so
a page exporting only `{ title, description, alternates }` inherits the
root layout's `openGraph` object whole. og:title, og:description and
og:url were the homepage's on all 45 spec landing pages, every doc, every
report and every SPA section.
Blog posts were the one route that declared openGraph, and they proved
the mechanism: their og:title is right. They also showed the other half
of it -- declaring openGraph drops the file-convention opengraph-image,
so live posts shipped with no og:image at all, and their twitter:title
was still the homepage's.
- src/lib/page-meta.ts: one builder, three entry points. specMetadata
titles a spec landing page from its lib/specs.ts entry, pageMetadata
titles the site's own pages from PAGE_META, contentMetadata titles a
doc, post, skill or ontology record from its content. All three always
emit openGraph and twitter title, description, url and image.
- Spec titles come from the registry, so they cannot drift from the way
the sidebar, /specs and the home page describe the same spec, and a new
spec page is titled the moment its registry entry exists. composeTitle
trims a long subject line at a clause boundary to fit a link preview.
- Doc pages carry that subject line too, because every spec's H1 is just
its name: "OpenStream" alone was the whole title.
- docExcerpt joins the wrapped lines of the first real paragraph and
skips Status:/Slug: headers and list lead-ins, so descriptions stopped
being "Status: 0.1 draft" and "Core tables:".
- contract/page-metadata.contract.test.ts fails if a sitemap route has no
title, if a spec page has no registry entry, if two pages share a
title, if a page declares metadata without the builder, or if a page
loses its social image.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
baa3adf716
commit
61870aa481
57 changed files with 909 additions and 361 deletions
|
|
@ -2,6 +2,7 @@ import { notFound } from "next/navigation";
|
|||
import type { Metadata } from "next";
|
||||
import type { ReactNode } from "react";
|
||||
import { renderPageMarkup } from "@/lib/page-markup";
|
||||
import { pageMetadata, specMetadata } from "@/lib/page-meta";
|
||||
import { HomeInteractivity } from "@/components/home-interactivity";
|
||||
|
||||
// The legacy SPA served the same single page for every top-level path and just
|
||||
|
|
@ -14,28 +15,16 @@ import { HomeInteractivity } from "@/components/home-interactivity";
|
|||
// have a matching section id in `renderPageMarkup` -- /privacy used to be
|
||||
// listed without one, so it served the whole homepage and scrolled to a card
|
||||
// that only described the page that did not exist.
|
||||
const ROUTE_META: Record<string, { title: string; description: string }> = {
|
||||
openspec: {
|
||||
title: "LogicSRC vs OpenSpec.dev · LogicSRC",
|
||||
description: "How LogicSRC's coordination standard compares with OpenSpec.dev, including MCP and agent support.",
|
||||
},
|
||||
"credential-sharing": {
|
||||
title: "Credential Sharing · LogicSRC",
|
||||
description: "End-to-end-encrypted team vaults plus source/target credential diffs, approval, sync, rollback, and audit across .env, Doppler, Railway, GitHub Secrets, and sh1pt.",
|
||||
},
|
||||
"hire-us": {
|
||||
title: "Hire Us · LogicSRC",
|
||||
description: "Implementation help for LogicSRC, AgentSwarm, and Credential Sharing at $400/hour/agent for accepted work, paid via CoinPay.",
|
||||
},
|
||||
// /agent-swarm was the AgentSwarm placeholder band. It is now the OpenFleet
|
||||
// spec at app/openfleet; next.config.ts redirects the old path there.
|
||||
agentbyte: {
|
||||
title: "AgentByte · LogicSRC",
|
||||
description: "Agent screening sessions, AI-assisted humans, policy events, and APIs.",
|
||||
},
|
||||
};
|
||||
|
||||
const KNOWN_ROUTES = new Set(Object.keys(ROUTE_META));
|
||||
// These render the homepage scrolled to their own section, so with no metadata
|
||||
// of their own they were published under the homepage's title -- the bug that
|
||||
// made every shared link read "LogicSRC — Open Coordination Standards".
|
||||
// openspec, credential-sharing and agentbyte are specs, titled from
|
||||
// lib/specs.ts; hire-us is one of the site's own pages.
|
||||
// /agent-swarm was the AgentSwarm placeholder band. It is now the OpenFleet
|
||||
// spec at app/openfleet; next.config.ts redirects the old path there.
|
||||
const SPEC_SECTIONS = new Set(["openspec", "credential-sharing", "agentbyte"]);
|
||||
const SITE_SECTIONS = new Set(["hire-us"]);
|
||||
const KNOWN_ROUTES = new Set([...SPEC_SECTIONS, ...SITE_SECTIONS]);
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
|
|
@ -44,14 +33,9 @@ export async function generateMetadata({
|
|||
}): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
const key = slug?.[0];
|
||||
if (key && ROUTE_META[key]) {
|
||||
return {
|
||||
title: ROUTE_META[key].title,
|
||||
description: ROUTE_META[key].description,
|
||||
alternates: { canonical: `/${key}` },
|
||||
};
|
||||
}
|
||||
return {};
|
||||
if (key && SPEC_SECTIONS.has(key)) return specMetadata(`/${key}`);
|
||||
if (key && SITE_SECTIONS.has(key)) return pageMetadata(`/${key}`);
|
||||
return pageMetadata("/");
|
||||
}
|
||||
|
||||
export default async function Page({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue