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

The front page's tab title reads "forge", not "forge · forge" #6056

Merged opened this

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

Merged

scout/forge:scout/6037-the-front-page-s-tab-title-reads-forge-n → main 1 commit fork 1 thread · 1 unresolved

  • Merged. scout/6037-the-front-page-s-tab-title-reads-forge-n was merged into main as 59aad6a.

Review

Sign in to review this change.
2 files changed +36 −1
src/web/layout.ts +1 −1
@@ -549,7 +549,7 @@ export function page(options: PageOptions, status = 200): Response {
549549 name="viewport"
550550 content="width=device-width, initial-scale=1, viewport-fit=cover"
551551 />
552 <title>${options.title} · forge</title>
552 <title>${options.title === "forge" ? "forge" : `${options.title} · forge`}</title>
553553 <meta name="description" content="${pageDescription(options)}" />
554554 <meta property="og:site_name" content="forge" />
555555 <meta property="og:type" content="website" />
test/page-title.test.ts added +35
@@ -0,0 +1,35 @@
1 /** The tab title names the forge once (#6037). */
2 import { afterAll, beforeAll, expect, test } from "bun:test";
3 import { mkdtemp, rm } from "node:fs/promises";
4 import { tmpdir } from "node:os";
5 import { join } from "node:path";
6 import { createApp, type App } from "../src/app.ts";
7 import { serve, type Servers } from "../src/http/server.ts";
8
9 let dataDir: string;
10 let app: App;
11 let servers: Servers;
12
13 beforeAll(async () => {
14 dataDir = await mkdtemp(join(tmpdir(), "forge-title-"));
15 app = createApp({ dataDir, port: 0 });
16 servers = await serve(app);
17 });
18
19 afterAll(async () => {
20 servers.stop();
21 app.close();
22 await rm(dataDir, { recursive: true, force: true });
23 });
24
25 const page = async (path: string) => (await fetch(`${servers.url}${path}`)).text();
26
27 test("the front page is titled forge, once", async () => {
28 const raw = await page("/");
29 expect(raw).toContain("<title>forge</title>");
30 expect(raw).toContain('property="og:title" content="forge"');
31 });
32
33 test("another page keeps its suffix", async () => {
34 expect(await page("/login")).toMatch(/<title>[^<]+ · forge<\/title>/);

/login is not a page here (preview gives "Not found · forge"); use an existing route so the assertion means something.

35 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs