Add /guides to the main nav
Internal linking from every page is the cleanest signal to Google that /guides isn't a stray page. The previous wiring linked it from the homepage's "play" section and from /games — fine for visitors, weaker for crawlers. Nav order is home · games · guides · agents · leaderboard, with the new section type and active-state highlight landing correctly on both /guides and /guides/:slug. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2 files changed · +4 −4
src/render.ts
+2
−2
| @@ -3,7 +3,7 @@ import { marked } from "marked"; | ||
| 3 | 3 | const STYLE_CSS = "./public/style.css"; |
| 4 | 4 | const css = await Bun.file(STYLE_CSS).text(); |
| 5 | 5 | |
| 6 | -export type Section = "home" | "games" | "agents" | "leaderboard"; | |
| 6 | +export type Section = "home" | "games" | "guides" | "agents" | "leaderboard"; | |
| 7 | 7 | |
| 8 | 8 | export interface PageOptions { |
| 9 | 9 | title: string; |
| @@ -25,7 +25,7 @@ const navLink = (href: string, label: string, active: boolean): string => { | ||
| 25 | 25 | return `<a href="${href}"${cls}>${label}</a>`; |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | -const nav = (active?: Section): string => `<nav class="md-nav">${navLink("/", "tdd.md", active === "home")} <span class="md-nav-sep">·</span> ${navLink("/games", "games", active === "games")} <span class="md-nav-sep">·</span> ${navLink("/agents", "agents", active === "agents")} <span class="md-nav-sep">·</span> ${navLink("/leaderboard", "leaderboard", active === "leaderboard")}</nav>`; | |
| 28 | +const nav = (active?: Section): string => `<nav class="md-nav">${navLink("/", "tdd.md", active === "home")} <span class="md-nav-sep">·</span> ${navLink("/games", "games", active === "games")} <span class="md-nav-sep">·</span> ${navLink("/guides", "guides", active === "guides")} <span class="md-nav-sep">·</span> ${navLink("/agents", "agents", active === "agents")} <span class="md-nav-sep">·</span> ${navLink("/leaderboard", "leaderboard", active === "leaderboard")}</nav>`; | |
| 29 | 29 | |
| 30 | 30 | export const renderPage = async (opts: PageOptions): Promise<string> => { |
| 31 | 31 | const body = await marked.parse(opts.bodyMarkdown, { gfm: true, breaks: false }); |
src/server.ts
+2
−2
| @@ -705,7 +705,7 @@ ${rows} | ||
| 705 | 705 | description: "Practical TDD walkthroughs for Claude Code, Cursor, Aider and other AI coding agents — keep your agent honest with red→green→refactor commits, scored by tdd.md.", |
| 706 | 706 | bodyMarkdown: body, |
| 707 | 707 | ogPath: "https://tdd.md/guides", |
| 708 | - active: "games", | |
| 708 | + active: "guides", | |
| 709 | 709 | }); |
| 710 | 710 | return htmlResponse(html); |
| 711 | 711 | }, |
| @@ -728,7 +728,7 @@ ${rows} | ||
| 728 | 728 | description: entry.description, |
| 729 | 729 | bodyMarkdown: md, |
| 730 | 730 | ogPath: `https://tdd.md/guides/${slug}`, |
| 731 | - active: "games", | |
| 731 | + active: "guides", | |
| 732 | 732 | }); |
| 733 | 733 | return htmlResponse(html); |
| 734 | 734 | }, |