From 696d727e4431cf24b96d8eb2cfac281b957ed134 Mon Sep 17 00:00:00 2001 From: artheru Date: Wed, 10 Jun 2026 09:36:44 +0800 Subject: [PATCH] dynamic per-route + per-subdomain document titles (0.71.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - the SPA had one static title, so every tavern route and the docs/pm subdomains all read 'amerc — hire agents like mercenaries' in the tab - tavern now sets a descriptive title per route (Browse Agents · amerc, System status · amerc, etc.); docs/pm set 'Docs · amerc' / 'PM · amerc' - clearer browser tabs, bookmarks and history - verified live across home/agents/status + docs + pm --- index.html | 2 +- package.json | 2 +- src/Scene2D.jsx | 8 +++++++- src/main.jsx | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 76a0bb7..9cec7a6 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - + diff --git a/package.json b/package.json index acbb041..99da05d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amerc-site", - "version": "0.70.0-mobilemenu", + "version": "0.71.0-titles", "private": true, "type": "module", "scripts": { diff --git a/src/Scene2D.jsx b/src/Scene2D.jsx index dec3897..9d74c58 100644 --- a/src/Scene2D.jsx +++ b/src/Scene2D.jsx @@ -7,7 +7,7 @@ import Account from './Account.jsx'; import TavernGame from './TavernGame.jsx'; import { api } from './api.js'; -const RELEASE = '0.70.0-mobilemenu'; +const RELEASE = '0.71.0-titles'; const NAV = [ { id: 'home', label: 'Tavern' }, @@ -16,6 +16,11 @@ const NAV = [ { id: 'booth', label: 'My Booth' }, ]; const VALID_ROUTES = ['home', 'agents', 'mansion', 'booth', 'account', 'admin', 'signin', 'status', 'changelog']; +const ROUTE_TITLES = { + home: 'amerc — hire agents like mercenaries', agents: 'Browse Agents · amerc', mansion: 'The Mansion · amerc', + booth: 'My Booth · amerc', account: 'Account · amerc', signin: 'Sign in · amerc', status: 'System status · amerc', + changelog: 'Changelog · amerc', admin: 'Quartermaster · amerc', +}; function useHashRoute() { const normalize = () => { @@ -451,6 +456,7 @@ export default function Scene2DApp() { const [route, setRoute] = useHashRoute(); const auth = useAuth(); const isHome = route === 'home'; + useEffect(() => { document.title = ROUTE_TITLES[route] || 'amerc'; }, [route]); return (

amerc agent mercenary tavern

diff --git a/src/main.jsx b/src/main.jsx index 10f9e01..06893f0 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -9,8 +9,8 @@ const PmApp = lazy(() => import('./PmApp.jsx')); const Scene2DApp = lazy(() => import('./Scene2D.jsx')); let App = Scene2DApp; -if (host.startsWith('docs.')) App = DocsApp; -else if (host.startsWith('pm.')) App = PmApp; +if (host.startsWith('docs.')) { App = DocsApp; document.title = 'Docs · amerc'; } +else if (host.startsWith('pm.')) { App = PmApp; document.title = 'PM · amerc'; } // Preload the tavern's canvas tiles on the main domain so the scene paints as // soon as the app mounts — they download in parallel with the JS chunk instead