Public: anyone can read this; the crew can change it.

Each public page has its own meta description, not the forge's one generic sentence #13217

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/13209-each-public-page-has-its-own-meta-descri → main 5 commits fork

  • Merged. scout/13209-each-public-page-has-its-own-meta-descri was merged into main as 1d6f43b.

Review

Sign in to review this change.
10 files changed +93 −30
src/web/pages/agents.ts +6 −3
@@ -13,7 +13,7 @@ import { html, type Html } from "../html.ts";
1313 import { btn, disclosure, field as formField } from "../ui.ts";
1414 import { page } from "../layout.ts";
1515 import { renderMarkdown } from "../markdown.ts";
16 import { START_BUTTON, SITE_PATH } from "../site_line.ts";
16 import { START_BUTTON } from "../site_line.ts";
1717 import { llmsBody } from "../standards.ts";
1818 import { loadMcp } from "../../http/mcp/load.ts";
1919
@@ -58,7 +58,10 @@ function stepLine(step: string): Html {
5858 return html`${step.split(/`([^`]*)`/).map((part, i) => (i % 2 === 1 ? html`<code>${part}</code>` : part))}`;
5959 }
6060
61 /** The whole guide as the page draws it inside the disclosure: the text less its title, each address a link. */
61 /**
62 * The whole guide as the page draws it inside the disclosure: the text less its title, each address
63 * a link.
64 */
6265 export function guideHtml(body: string): Html {
6366 return renderMarkdown(linkAddresses(withoutTitle(body)));
6467 }
@@ -70,7 +73,7 @@ export async function agentsPage(ctx: Ctx): Promise<Response> {
7073 return timePhase(ctx.request, "render", () => page({
7174 ctx,
7275 title: "For AI assistants",
73 description: SITE_PATH(ctx.url.origin),
76 description: "How an AI agent finds this forge, signs in over MCP and OAuth, and reports a problem or offers a change.",
7477 body: html`${pageHead("For AI assistants", {
7578 sub: html`People start at <a href="/">home</a>. Assistants: <a href="/llms.txt">/llms.txt</a>`,
7679 })}
src/web/pages/changelog.ts +1 −1
@@ -331,7 +331,7 @@ export async function changelogPage(ctx: Ctx): Promise<Response> {
331331 ]);
332332 const body = html`${pageHead("Changelog", { sub: "What went live, as it happens." })}${nearBlock(planned === undefined ? "" : repoBase(planned.repo), near)}${filters}${betFilters}${read.own !== undefined && readable ? html`<p class="small"><a href="/${read.own}/waves" data-waves-link>Read it by wave</a></p>` : null}
333333 <div id="shipped" data-live="${LIVE}" aria-live="polite">${shippedRegion(read, choice, new Date(), "UTC", toLive, readable, chapters, bet, target)}</div>`;
334 const response = page({ ctx, title: "Changelog", body, feed: { href: "/changelog.atom", title: "Changelog" }, json: { href: `/api/v1/changelog${choice === read.own ? "" : `?repo=${encodeURIComponent(choice)}`}`, title: "Changelog (JSON)" }, scriptJs: `${liveRegionsJs}\n${localDaysJs}` });
334 const response = page({ ctx, title: "Changelog", description: "What shipped on this forge, newest first: each change that landed and when.", body, feed: { href: "/changelog.atom", title: "Changelog" }, json: { href: `/api/v1/changelog${choice === read.own ? "" : `?repo=${encodeURIComponent(choice)}`}`, title: "Changelog (JSON)" }, scriptJs: `${liveRegionsJs}\n${localDaysJs}` });
335335 notePhase(ctx.request, "render", performance.now() - rendering);
336336 if (keep === undefined) return response;
337337 const headers = new Headers(response.headers);
src/web/pages/packs.ts +3 −2
@@ -1,7 +1,8 @@
11 /**
22 * `/packs` and `/packs/:name`: the forge packs this forge ships (`src/packs/`).
33 * A pack's page says what it brings, the one command that deploys it on your
4 * own machine, and a link to start a forge of your own. Server-rendered, no script; anyone may read it.
4 * own machine, and a link to start a forge of your own. Server-rendered, no script; anyone may read
5 * it.
56 */
67
78 import { notePhase, takeSessionTime } from "../../core/route_timing.ts";
@@ -102,7 +103,7 @@ export async function packsPage(ctx: Ctx): Promise<Response> {
102103 </form>`
103104 : null}
104105 </section>`}`;
105 const response = page({ ctx, title: "Packs", body });
106 const response = page({ ctx, title: "Packs", description: "Packs of apps and crew members you can take whole and make your own.", body });
106107 notePhase(ctx.request, "render", performance.now() - started);
107108 return response;
108109 }
src/web/pages/pricing.ts +10 −6
@@ -23,7 +23,7 @@ import { field, readForm } from "../form.ts";
2323 import { html, type Html } from "../html.ts";
2424 import { page, redirect } from "../layout.ts";
2525 import { planOfferRow } from "../plan_offer_row.ts";
26 import { START_BUTTON, SITE_PATH } from "../site_line.ts";
26 import { START_BUTTON } from "../site_line.ts";
2727 import { offerData, sharedProperties } from "../offer.ts";
2828 import { safeJson } from "../structured_data.ts";
2929 import { btn, field as formField } from "../ui.ts";
@@ -40,7 +40,8 @@ interface Values {
4040 const isBuyer = (ctx: Ctx): boolean => ctx.auth.user === undefined || ctx.auth.user.kind === "user";
4141
4242 function plansView(ctx: Ctx, values: Values, errors: Partial<Record<Refusal["field"], string>>): Html {
43 // The order this browser paid for, from its own cookie: the page that opens it needs the address of the order.
43 // The order this browser paid for, from its own cookie: the page that opens it needs the address
44 // of the order.
4445 const held = (cookieValue(ctx.request, COOKIE) ?? "").split(".")[0] ?? "";
4546 const ordered = /^ord_[0-9a-f]{32}$/.test(held) ? held : undefined;
4647 const selling = checkoutOf(ctx.app) !== undefined;
@@ -93,7 +94,7 @@ export function pricingPage(ctx: Ctx): Response {
9394 const response = page({
9495 ctx,
9596 title: "Open Platform Forge: pricing and your own forge",
96 description: SITE_PATH(ctx.url.origin),
97 description: "What each forge plan costs and the CPU, memory, disk and crew credit it includes.",
9798 tight: true,
9899 jsonLd: safeJson({ "@context": "https://schema.org", "@type": "Product", name: "Open Platform Forge", url: `${ctx.url.origin}/`, additionalProperty: sharedProperties(lapseRule(ctx.app.db)), offers: offerData(plans, ctx.url.origin, lapseRule(ctx.app.db), true) }),
99100 body: plansView(ctx, { name: (ctx.url.searchParams.get("name") ?? "").slice(0, 38), email: "" }, {}),
@@ -105,7 +106,8 @@ export function pricingPage(ctx: Ctx): Response {
105106 const cookieFor = (ctx: Ctx, value: string, maxAge: number): string =>
106107 setCookie(COOKIE, value, { path: "/pricing", maxAge, secure: secureFor(ctx.url, ctx.app.config.url) });
107108
108 // POST /pricing/order — free goes on to the free path; a paid plan holds the name and goes to checkout.
109 // POST /pricing/order — free goes on to the free path; a paid plan holds the name and goes to
110 // checkout.
109111 export async function pricingOrder(ctx: Ctx): Promise<Response> {
110112 if (!isBuyer(ctx)) return notFoundPage(ctx);
111113 const form = await readForm(ctx, ctx.auth.user === undefined ? undefined : "admin");
@@ -144,7 +146,8 @@ const waiting = (ctx: Ctx, says: string): Response => {
144146 return res;
145147 };
146148
147 // GET /pricing/done?order= — reconciles the order with the provider, waits for the forge, shows the link once.
149 // GET /pricing/done?order= — reconciles the order with the provider, waits for the forge, shows the
150 // link once.
148151 export async function pricingDone(ctx: Ctx): Promise<Response> {
149152 notePhase(ctx.request, "session", takeSessionTime(ctx.request));
150153 const rendering = performance.now();
@@ -198,7 +201,8 @@ export function resendPage(ctx: Ctx): Response {
198201 return response;
199202 }
200203
201 // POST /pricing/resend — the link goes to the order's own email; the answer is the same whether or not an order matched.
204 // POST /pricing/resend — the link goes to the order's own email; the answer is the same whether or
205 // not an order matched.
202206 export async function resendSubmit(ctx: Ctx): Promise<Response> {
203207 if (!isBuyer(ctx)) return notFoundPage(ctx);
204208 const form = await readForm(ctx, ctx.auth.user === undefined ? undefined : "admin");
src/web/pages/privacy.ts +1
@@ -14,6 +14,7 @@ export function privacyPage(ctx: Ctx): Response {
1414 page({
1515 ctx,
1616 title: "Privacy",
17 description: "What this forge keeps about visitors, for how long, and what it never keeps.",
1718 body: html`<div class="page-head"><h1>Privacy</h1></div>
1819 <ul class="list">
1920 <li>
src/web/pages/site.ts +8 −4
@@ -206,7 +206,8 @@ export function terminalCard(ctx: Ctx): Html {
206206 // the feed (`studioHome`, #599), whatever the mode (#625).
207207 export async function home(ctx: Ctx): Promise<Response> {
208208 const user = ctx.auth.user;
209 // A gift link (`/?code=`) keeps the code in a cookie and opens the new-forge form, so the next address has no code in it (#11157).
209 // A gift link (`/?code=`) keeps the code in a cookie and opens the new-forge form, so the next
210 // address has no code in it (#11157).
210211 const gift = ctx.url.searchParams.get("code");
211212 if (gift !== null && gift !== "") return keepGift(gift.slice(0, 64), "/forges/new", ctx.url, ctx.app.config.url);
212213 // The home is one page (`pages/home_flow.ts`): the switch it was tried behind goes to it.
@@ -477,7 +478,7 @@ export function signinPage(ctx: Ctx): Response {
477478 notePhase(ctx.request, "session", takeSessionTime(ctx.request));
478479 const body = authForm(ctx, "signin");
479480 return timePhase(ctx.request, "render", () =>
480 page({ ctx, title: "Sign in", body, scriptJs: passkeyJs }),
481 page({ ctx, title: "Sign in", description: "Sign in to your forge with your passkey.", body, scriptJs: passkeyJs }),
481482 );
482483 }
483484
@@ -493,7 +494,10 @@ export function inviteOf(ctx: Ctx): string | undefined {
493494 return token === "" ? undefined : token;
494495 }
495496
496 /** The one place the forge says its accounts are closed: `/signin` (and `/signup` through its own message), never the home page (#11325). */
497 /**
498 * The one place the forge says its accounts are closed: `/signin` (and `/signup` through its own
499 * message), never the home page (#11325).
500 */
497501 function byInvitationLine(): Html {
498502 return html`<p class="small mb" id="by-invitation">Accounts on this forge are by invitation. <a href="/#yours">Start your own forge instead.</a></p>`;
499503 }
@@ -527,7 +531,7 @@ export function signupPage(ctx: Ctx): Response {
527531 if (first) return first;
528532 const body = authForm(ctx, "signup");
529533 return timePhase(ctx.request, "render", () =>
530 page({ ctx, title: "Sign up", body, turnstile: siteKey(ctx) !== undefined, scriptJs: passkeyJs }),
534 page({ ctx, title: "Sign up", description: "Make your forge: pick a username and create a passkey, and a crew starts building your apps.", body, turnstile: siteKey(ctx) !== undefined, scriptJs: passkeyJs }),
531535 );
532536 }
533537
src/web/studio/explore.ts +7 −3
@@ -139,7 +139,10 @@ function chipRow(query: ExploreQuery): Html {
139139 </div>`;
140140 }
141141
142 /** What the filter's terms are, for a link that takes one away: the owner too, which `terms` leaves to the line. */
142 /**
143 * What the filter's terms are, for a link that takes one away: the owner too, which `terms` leaves
144 * to the line.
145 */
143146 function removable(query: ExploreQuery): { term: string; without: ExploreQuery }[] {
144147 const out = terms(query).filter((t) => !t.term.startsWith("sort:"));
145148 if (query.owner !== undefined) {
@@ -276,8 +279,9 @@ export async function explorePage(ctx: Ctx): Promise<Response> {
276279 })}${more === null
277280 ? html``
278281 : html`<div class="explore-more">${btn("More results", { href: `${here}${here.includes("?") ? "&" : "?"}cursor=${encodeURIComponent(more)}`, variant: "outline", extra: "explore-more-link" })}</div>`}</div>`;
279 const drawn = page({ ctx, title: "Explore", body: compact(body), feed: { href: "/explore.atom", title: "Explore" } });
280 // An unknown filter is ignored with a plain note on the page (200); the API and the MCP stay strict.
282 const drawn = page({ ctx, title: "Explore", description: "Apps, forges and people on this forge, ranked by use, forks, ships and freshness.", body: compact(body), feed: { href: "/explore.atom", title: "Explore" } });
283 // An unknown filter is ignored with a plain note on the page (200); the API and the MCP stay
284 // strict.
281285 notePhase(ctx.request, "render", performance.now() - rendering);
282286 return drawn;
283287 }
src/web/studio/home.ts +11 −6
@@ -2,8 +2,8 @@
22 * The home in the studio: signed in, the feed — the composer, then one
33 * timeline — with your apps and what is on you beside it (#599). Built from
44 * the same cards as the rest of the forge, from grouped reads only, so the
5 * page does not get slower as the apps grow. A stranger gets the door instead: the forge featured, then the
6 * best of what is public (`actions/front.ts`).
5 * page does not get slower as the apps grow. A stranger gets the door instead: the forge featured,
6 * then the best of what is public (`actions/front.ts`).
77 */
88
99 import { UPSTREAM_REPO } from "../../core/upstream.ts";
@@ -39,7 +39,7 @@ import { liveRegionsJs } from "../client.ts";
3939 import { html, when, type Html } from "../html.ts";
4040 import { fragment, page, redirect } from "../layout.ts";
4141 import { START_REFUSALS, startRefusalIn } from "../start_refusal.ts";
42 import { SITE_PATH, SITE_WHAT } from "../site_line.ts";
42 import { SITE_WHAT } from "../site_line.ts";
4343 import { siteStructuredData } from "../structured_data.ts";
4444 import { running } from "../../kernel/version.ts";
4545 import { biggestMilestones, homeMilestones } from "./milestone_lines.ts";
@@ -483,7 +483,9 @@ function frontControls(ctx: Ctx, front: FrontPage): Html {
483483 );
484484 }
485485
486 /** How many apps the door shows: the pins, then the best of the rest, with a link to all of them. */
486 /**
487 * How many apps the door shows: the pins, then the best of the rest, with a link to all of them.
488 */
487489 const DOOR_TILES = 8;
488490
489491 /** The live address of an app a stranger may open, or nothing. */
@@ -500,7 +502,10 @@ const DOOR_STATE: Partial<Record<EnvState, string>> = {
500502 deploying: "Updating",
501503 };
502504
503 /** What a stranger can do to help with an app: make an account if this forge takes new ones, or send its keepers a note. */
505 /**
506 * What a stranger can do to help with an app: make an account if this forge takes new ones, or send
507 * its keepers a note.
508 */
504509 function helpDoor(repo: FrontEntry["repo"], accounts: boolean): Html {
505510 return accounts
506511 ? html`<a href="/signup?next=${encodeURIComponent(repoBase(repo))}">Help build</a>`
@@ -833,7 +838,7 @@ bun run src/main.ts</code></pre>
833838 const res = page({
834839 ctx,
835840 title: "Open Platform Forge: software for what you're building, yours to keep",
836 description: `${SITE_WHAT} ${SITE_PATH(origin)}`,
841 description: SITE_WHAT,
837842 body,
838843 scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${funnelJs}\n${startNameJs}`,
839844 jsonLd: siteStructuredData(origin, running().version),
test/page-descriptions.test.ts added +43
@@ -0,0 +1,43 @@
1 /**
2 * Every signed-out public page says in one sentence what it is; no two share one, none falls back
3 * to the site line.
4 */
5 import { afterAll, beforeAll, expect, test } from "bun:test";
6 import { mkdtemp, rm } from "node:fs/promises";
7 import { tmpdir } from "node:os";
8 import { join } from "node:path";
9 import { createApp, type App } from "../src/app.ts";
10 import { serve, type Servers } from "../src/http/server.ts";
11
12 const PAGES = ["/", "/pricing", "/explore", "/changelog", "/signup", "/signin", "/privacy", "/packs", "/docs", "/agents"];
13 const SITE_DEFAULT = "Your software and the crew that builds it, in one place.";
14
15 let dir: string;
16 let app: App;
17 let servers: Servers;
18 beforeAll(async () => {
19 dir = await mkdtemp(join(tmpdir(), "forge-descriptions-"));
20 app = createApp({ dataDir: dir, port: 0 });
21 servers = await serve(app);
22 });
23 afterAll(async () => {
24 servers.stop();
25 app.close();
26 await rm(dir, { recursive: true, force: true });
27 });
28
29 test("each public page has its own short description", async () => {
30 const seen = new Map<string, string>();
31 for (const path of PAGES) {
32 const res = await fetch(`${servers.url}${path}`, { redirect: "follow" });
33 const text = await res.text();
34 const m = text.match(/<meta name="description" content="([^"]*)"/);
35 expect(m, `${path} has a description`).not.toBeNull();
36 const d = m![1]!;
37 expect(d, `${path} is not the site default`).not.toBe(SITE_DEFAULT);
38 expect(d.length, `${path} is under 160 characters`).toBeLessThan(160);
39 expect(d.length).toBeGreaterThan(20);
40 expect(seen.get(d), `${path} shares its description with ${seen.get(d)}`).toBeUndefined();
41 seen.set(d, path);
42 }
43 });
test/share-path.test.ts +3 −5
@@ -29,19 +29,17 @@ const get = async (path: string): Promise<string> => (await fetch(`${base}${path
2929 test("/, /pricing, /agents and /llms.txt each give the one-line path with the one button name", async () => {
3030 const line = SITE_PATH(base);
3131 expect(line).toContain(`press ${START_BUTTON}.`);
32 // The path used to be these pages' meta description; each has its own now (#13209), so it is
33 // /llms.txt's.
3234 for (const path of ["/", "/pricing", "/agents", "/llms.txt"]) {
3335 const text = (await get(path)).replaceAll("&#39;", "'");
34 expect(text, path).toContain(line);
36 if (path === "/llms.txt") expect(text, path).toContain(line);
3537 expect(text, path).toContain(START_BUTTON);
3638 expect(text, path).not.toContain("Spawn");
3739 expect(text, path).not.toContain("New app");
3840 }
3941 const llms = await get("/llms.txt");
4042 expect(llms.split("\n").slice(0, 8).join("\n")).toContain(line);
41 for (const path of ["/", "/pricing"]) {
42 const head = await get(path);
43 expect(head).toContain(`<meta name="description" content="${path === "/" ? "Open Platform Forge gives you a forge of your own where an AI crew builds your apps. " : ""}${line}`);
44 }
4543 });
4644
4745 test("/pricing's free start is the home form's one step: a name and the same button, posted to the same door", async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs