logicsrc/apps/logicsrc-web/src/app/openwiki/page.tsx
Anthony Ettinger 61870aa481
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>
2026-09-24 01:00:25 -07:00

220 lines
9.3 KiB
TypeScript

import Link from "next/link";
import type { ReactNode } from "react";
import type { Metadata } from "next";
import { specMetadata } from "@/lib/page-meta";
import { SiteShell } from "@/components/site-shell";
import { mono, pre, table, td, th } from "../openontology/ui";
export const metadata: Metadata = specMetadata(
"/openwiki",
"OpenWiki is a wiki that is a folder of Markdown files: [[Page]] links, a small front matter vocabulary, a descriptor at /.well-known/openwiki.json, an index of pages, every page and every revision readable as Markdown, and made_by on every revision, human, ai or both. Opens unchanged in Obsidian and Logseq."
);
const PAGE = `---
title: Going viral
aliases: [virality, viral loop]
tags: [growth, distribution]
summary: What makes a thing spread, and what only looks like it.
author: https://chovy.com/.well-known/openprofile.md
made_by: both
disclosure: ai-assisted
ai_model: gpt-5.1
ai_provider: OpenAI
ai_prompt_url: https://goviral.wiki/ai-methodology#pages
updated: 2026-09-13T12:40:00Z
---
A thing goes viral when each person who sees it shows it to more
than one other person on average. See [[K-factor]] and
[[Webrings|the webring case]]. Nothing else counts.`;
const WIKI = `{
"openwiki": "0.1",
"wiki": { "name": "goviral.wiki", "url": "https://goviral.wiki/",
"license": "CC-BY-4.0",
"operator": "https://profullstack.com/.well-known/openprofile.md" },
"pages_url": "https://goviral.wiki/pages.json",
"changes": "https://goviral.wiki/changes.atom",
"repo": "https://github.com/profullstack/goviral.wiki",
"edit": "https://goviral.wiki/edit/",
"editors": "accounts",
"accepts": ["human", "ai", "both"]
}`;
const PUT = `PUT /going-viral.md
Content-Type: text/markdown; charset=utf-8
If-Match: "8f3a1c"
Authorization: Bearer <token>
X-OpenWiki-Summary: Fixed the K-factor formula
X-OpenWiki-Made-By: ai`;
const RESOLVE: Array<[string, string]> = [
["Exact name", "A page named exactly that."],
["Loose name", "Case-insensitive; spaces, hyphens and underscores are one character. [[going viral]], [[Going-Viral]] and [[going_viral]] are one link."],
["Alias", "A page listing the name under aliases."],
["Path", "A page in a folder by that path, when the link contains a slash."],
["Nothing", "A page that does not exist yet: a host offers to create it, a directory lists it under wanted."]
];
const URLS: Array<[string, string]> = [
["GET /going-viral", "The page rendered, with a rel=alternate link to the Markdown."],
["GET /going-viral.md", "The file as stored, front matter and all. ETag is the revision id."],
["GET /going-viral.md?rev=<id>", "That revision's file."],
["GET /going-viral.history.json", "Every revision: id, time, author, made_by, summary, parent."],
["PUT /going-viral.md", "The whole file back, with If-Match on the revision you started from. 412 means read and retry."]
];
const ABSENT: Array<[string, string]> = [
["No markup of its own", "The body is Markdown as every tool already writes it. A host serves the file as written."],
["No verification of made_by", "A statement per revision. The history is where the truth accumulates."],
["No central registry", "A wiki is a folder on a host; a directory is optional."],
["No user model", "author is a URL or a name. Who may edit is one word, editors; how they sign in is the host's affair."],
["No engine", "Obsidian is a host that serves nothing; Quartz is a host that renders; a git remote with two JSON files is a host."]
];
export default function OpenWikiPage(): ReactNode {
return (
<SiteShell active="OpenWiki">
<div className="band">
<div className="section-head">
<p className="eyebrow">LogicSRC standards surface</p>
<h2>OpenWiki</h2>
<p>
A wiki that is a folder of Markdown files. [[Page]] links, a small front matter
vocabulary, two files the wiki serves about itself, every page and every revision
readable as Markdown, and on every revision: human, ai, or both.
</p>
</div>
<p style={{ color: "#41505d" }}>
There is no open wiki format. MediaWiki&apos;s wikitext is one engine&apos;s shape,
WikiCreole stalled in 2007, and what everybody uses now is Markdown files linked with
[[Page]]: Obsidian, Logseq, Foam, Quartz and a dozen others read it, and none agrees on
what goes above the first line, how a link finds its page, where the history lives, or
how another program finds out the folder is a wiki. The format is there. This is the two
files that say so, and the rules the tools already mostly follow.
</p>
<p style={{ color: "#5b6b7a" }}>
Status: 0.1.1. A folder that follows this opens unchanged in Obsidian and Logseq, and any
such folder becomes an OpenWiki by adding the two files. The first host,{" "}
<a href="https://goviral.wiki/">goviral.wiki</a>, is being built on it.
</p>
</div>
<div className="band">
<div className="section-head">
<h2>The page</h2>
<p>One Markdown file. Front matter above the first rule, every key optional, absent unstated.</p>
</div>
<pre style={pre}>{PAGE}</pre>
<p style={{ color: "#41505d" }}>
<code style={mono}>made_by</code> and <code style={mono}>author</code> describe the page as
it stands; the history carries them per revision. <code style={mono}>disclosure</code>{" "}
uses the W3C AI Content Disclosure vocabulary verbatim, with <code style={mono}>ai_model</code>,{" "}
<code style={mono}>ai_provider</code> and <code style={mono}>ai_prompt_url</code> beside it: the
same four a host puts on the rendered page as the group&apos;s meta tag and attributes. <code style={mono}>redirect</code>{" "}
names the page this one now is.
</p>
</div>
<div className="band">
<div className="section-head">
<h2>How a wikilink finds its page</h2>
<p>In this order. The first four are what the tools do; the fifth is what a wiki is for.</p>
</div>
<table style={table}>
<tbody>
{RESOLVE.map(([what, how]) => (
<tr key={what}>
<td style={td}>
<strong>{what}</strong>
</td>
<td style={td}>{how}</td>
</tr>
))}
</tbody>
</table>
</div>
<div className="band">
<div className="section-head">
<h2>One address, three representations, and the way back</h2>
</div>
<table style={table}>
<thead>
<tr>
<th style={th}>ask for</th>
<th style={th}>get</th>
</tr>
</thead>
<tbody>
{URLS.map(([ask, get]) => (
<tr key={ask}>
<td style={td}>
<code style={mono}>{ask}</code>
</td>
<td style={td}>{get}</td>
</tr>
))}
</tbody>
</table>
<pre style={pre}>{PUT}</pre>
<p style={{ color: "#41505d" }}>
An agent editing a wiki is a program reading a Markdown file and putting it back. That is
the whole API, and it is the same one a person&apos;s editor uses. A token from{" "}
<Link href="/openaccess">OpenAccess</Link> carries <code style={mono}>openwiki:edit</code>.
</p>
</div>
<div className="band">
<div className="section-head">
<h2>The wiki</h2>
<p>
One descriptor at <code style={mono}>/.well-known/openwiki.json</code>, an index of pages
at <code style={mono}>pages_url</code> with the link graph and the pages still wanted,
recent changes as Atom, and the folder as a git remote when it is one.
</p>
</div>
<pre style={pre}>{WIKI}</pre>
</div>
<div className="band">
<div className="section-head">
<h2>What is deliberately absent</h2>
</div>
<table style={table}>
<tbody>
{ABSENT.map(([what, why]) => (
<tr key={what}>
<td style={td}>
<strong>{what}</strong>
</td>
<td style={td}>{why}</td>
</tr>
))}
</tbody>
</table>
</div>
<div className="band">
<div className="section-head">
<h2>Where everything lives</h2>
</div>
<ul style={{ color: "#41505d", lineHeight: 1.9, paddingLeft: "1.1rem" }}>
<li>
<Link href="/docs/openwiki">Specification</Link>: the page and its front matter,
wikilinks and how they resolve, the URL, the history, the two files, editing,
discovery, what a directory owes a wiki
</li>
<li>
<a href="https://goviral.wiki/">goviral.wiki</a>: the first host, being built on this
</li>
<li>
<Link href="/openprofile">OpenProfile.md</Link>, the author of a page;{" "}
<Link href="/openwebring">OpenWebring</Link>, the same made_by on a site;{" "}
<Link href="/docs/opensite">OpenSite</Link>, the card a directory draws for a wiki
</li>
</ul>
</div>
</SiteShell>
);
}