# Set a Document Title per Page in a SolidJS App

Yes. An agent gives every route of your SolidJS app its own document title, updates article and profile titles once their data loads, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-page-titles/solidjs/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent starts with how the app routes. In an app like solidjs/solid-realworld there is no router package: `src/store/createRouteHandler.js` listens for `hashchange`, keeps the hash after `#/` in a `location` signal, and offers `match(name, regex)` and `getParams()`. `src/App.js` uses it in a `<Switch>` of seven `<Match>` cases: `editor`, `settings`, `login`, `register`, `article`, `profile` and the empty route for the home page, with `Settings` and `Auth` loaded through `lazy`. The only title in the whole app is the static `<title>Conduit</title>` in `public/index.html`, so the browser tab, history entries and bookmarks all read the same word whatever page is open.

It then decides where a title can be set without touching every page. The route handler already knows the route name and its parameters, so the agent adds a small `useTitle` helper in `src/store/` that sets `document.title` from a `createEffect`, taking the site name from `appName` in the store (`conduit`) rather than hard-coding it, and calls it once in `App.js` with a map from route name to title: Home, Sign in, Sign up, Settings, New Post, and the editor's slug when one is present. Because the store's `createRouteHandler` already wraps navigation in `useTransition`, the effect runs after the new page is matched, not before.

Two pages only know their title after a fetch. `src/pages/Article/Article.js` reads `store.articles[slug]` and renders `<h1>{article()?.title}</h1>` once `loadArticle(slug)` in `src/pages/Article/index.js` resolves; `src/pages/Profile/Profile.js` renders `props.username` and reads `store.profile` after `loadProfile`. For those two the agent sets a provisional title from the route first, then a `createEffect` inside the page updates it to the article's title or the `@username` when the resource arrives, so a reload lands on the right title too. The `lazy` imports stay as they are; the effect lives in the page component that already has the data.

The check is the built bundle and the page. The agent runs `npm install` and `npm run build`, which is `rollup -c --environment production` with `babel-preset-solid` from `rollup.config.js`, then serves `public/` as the `start` script does and opens the hash routes in the sandbox browser to read `document.title` on the home page, the login page and an article from the public RealWorld API at `https://api.realworld.io/api` that `src/store/createAgent.js` names. There is no test suite (`"test": "test"` in `package.json`), so the pull request quotes the titles it saw instead.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Give every page of this SolidJS app its own document title. Read public/index.html, src/index.js, src/App.js, src/store/index.js, src/store/createRouteHandler.js, src/components/NavLink.js and every file under src/pages first. Add a helper that sets document.title from the matched route name, using the store's appName as the suffix, and call it once in App.js. For the article and profile pages, set a provisional title from the route and update it from the loaded article title or the username once the data is in the store. Do not add a router or any dependency, and keep the hash routing and lazy imports unchanged. Run npm install and npm run build, serve the public folder, open the home, login and one article route in the browser, quote document.title for each, and open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch with one new file under `src/store/` (the title helper), a few lines in `src/App.js` that call it with the route-to-title map, and one `createEffect` each in `src/pages/Article/Article.js` and `src/pages/Profile/Profile.js`. `public/index.html` keeps its `<title>` as the fallback shown before the first effect runs, `rollup.config.js` and `package.json` are untouched, and no dependency is added.

The description quotes `document.title` as read in the browser for the home page, the login page and one article, and the production build output from Rollup. The full record, each command and each page the agent opened, is in the transcript at `GET /o/{org}/sessions/{id}/messages`.

Before merging, a reviewer decides the exact wording and separator, whether the editor should say Edit or New Post when a slug is present, and whether the profile's favourites tab deserves its own title. A follow-up message to the same session can add `<meta name="description">` handling in the same helper, or move the strings into one file for translation.

## Run it on every Linear issue labelled frontend

A team that tracks app polish in Linear starts one run per issue from an automation with a `linear` trigger on the `frontend` label, in the Project that holds this repository. The automation adds the issue after this prompt, so an issue that names the wording it wants, or asks for the article's author in the title as well, is what the agent reads.

Each run opens its own pull request from its own sandbox and links the issue, and an automation run has its own `max_runs_per_hour` cap. Because the title helper is one file and one call, two issues that touch different pages rarely conflict, and the second pull request rebases cleanly.

## Why run it on Rush?

Page titles in a single-page app are easy to forget and tedious to retrofit: the route handler is hand-written, two pages learn their title only after a fetch, and nothing tells you the tab still says Conduit until a user bookmarks the wrong thing. The agent reads the real routing code, puts the logic where the route name already is, and proves the result in a real browser against the real API, in a sandbox with the lockfile's packages.

The pull request carries the titles it read and the build log, so the review is a read of one helper and two effects. Several apps built on the same RealWorld pattern can be handled at once, each in its own sandbox with its own pull request.

## Frequently asked questions

### Will this add solid-router or a head-management library?

No. The app routes by hand through `createRouteHandler.js`, and that handler already knows the route name and parameters, so a `createEffect` that sets `document.title` is all that is needed. Adding a router to get titles would be a much larger change than the feature asks for.

### What does the article page show while it loads?

A provisional title from the route, such as the article's slug with the site name, set before the fetch. When `store.articles[slug]` arrives the page's effect replaces it with the real title, and a direct reload of an article URL ends on the right title the same way.

### The app has no tests. How is this checked?

In the browser. The sandbox builds the production bundle with the repository's own Rollup config, serves `public/` as the `start` script does, opens the home, login and article routes and reads `document.title` on each. Those values are quoted in the pull request, and the browser steps are in the transcript.

### Does it change the hash routing?

No. Navigation still goes through `#/` links built by `NavLink.js` and the `hashchange` listener in the route handler. The title helper only observes the matched route; it never writes to `location.hash`.

## More SolidJS jobs

- [Add PWA Support to a SolidJS App](https://getrush.ai/run/add-pwa-support/solidjs/)
- [Add Storybook to a SolidJS App](https://getrush.ai/run/add-storybook/solidjs/)
- [Convert a SolidJS App From JavaScript to TypeScript](https://getrush.ai/run/convert-javascript-to-typescript/solidjs/)

## The same job on other stacks

- [Add Page Titles per Route to a Vue App](https://getrush.ai/run/add-page-titles/vue/)
- [Add Page Titles per Route to an Angular App](https://getrush.ai/run/add-page-titles/angular/)

## More jobs like this: Turn a Linear label into a PR

- [Add Cursor Pagination to a FastAPI Endpoint from a Linear Issue](https://getrush.ai/run/add-pagination/fastapi/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
