Page titles and descriptions
The web app sets the browser tab title, the meta description, and the Open Graph title from one helper, lib/page-metadata.ts. A page does not declare export const metadata. Titles depend on the language and, inside an organisation, on the organisation or agent name, so every page exports generateMetadata.
The language is the NEXT_ cookie (fr or en). Without it, the default locale is used. Switching language refreshes the server render, which runs generateMetadata again.
The product name comes from NEXT_: BREIGN, or SKAI Admin when the value is SKAI.
Title templates​
Next.js fills a %s in the nearest layout template with the page title.
| Layout | Tab title |
|---|---|
Root (app/layout.tsx) | Page | BREIGN |
Organisation (app/[orgSlug]/layout.tsx) | Page | Organisation name |
Agent (app/(agent)/[orgSlug]/agents/[agentId]/layout.tsx) | Page | Agent name |
| Chat, outside the organisation layout | Chat | Organisation name, or Subject · Chat | Organisation name |
The organisation template replaces the root one for every page under app/[orgSlug]. The agent template replaces the organisation one for every page under the agent. A page only supplies the first segment. Writing the organisation name into the page title prints it twice.
Chat does not sit under the organisation layout, so its title is absolute and already contains the organisation name.
If the agent cannot be loaded, the agent segment is the translated word Agent.
A page with a fixed title​
Add the page to PAGE_ in lib/page-metadata.ts. A string value is the title key. The description key is metadata.descriptions.<page> unless you pass one.
const PAGE_META = {
engines: 'sidebar.aiEngines',
agentApps: 'metadata.titles.agentApps',
};
Reuse a sidebar label when the tab should say the same thing as the menu. Add metadata.titles.<page> only when the tab title differs. Add metadata.descriptions.<page> in messages/en/common.json and messages/fr/common.json for every page.
On the page or its layout:
import { meta } from '@/lib/page-metadata';
export const generateMetadata = meta('engines');
meta returns the translated title and description, and copies both into Open Graph.
Put generateMetadata on the layout when every child of that segment shares the title (Knowledge, Tools, Skills). Put it on the page when only that route has the title (Metrics, a workflow editor).
A page named after an organisation, an agent, or a chat​
These layouts are already wired:
export const generateMetadata = orgMeta();
export const generateMetadata = agentMeta(getAgentUioById);
export const generateMetadata = chatMeta();
A chat page about one agent or one session leads with that name:
export const generateMetadata = chatSubjectMeta<{ orgSlug: string; agentId: string }>(
async ({ agentId }) => (await getAgentUioById(agentId))?.name,
);
The function returns the subject (the agent name, or the session title). A missing subject falls back to Chat | Organisation name. The session page reads the conversation once, with React cache, so the title and the page share that read.
What a visitor sees​
The tab shows the page name, then the organisation or the agent. The meta description is the sentence under metadata.descriptions. Open Graph repeats that title and that description. Both follow NEXT_.