- adminMeta (default on, with or without whiteLabel): robots noindex/nofollow, title suffix "— <site> | Panel", og:site_name and en/pl description from Site settings, preview image GET /api/ipal/admin-og (next/og, from the logo or name, no external service) and icon GET /api/ipal/admin-icon - the site name sits in a process-wide store read through getters, so link previews stay current after a Site settings save and across config loads - agency option (default Intecion.com) feeds the credit, description and image; credit reads "Technology support: Intecion.com" (pl: Wsparcie technologiczne) - the project's own admin.meta keys always win; adminMeta: false / agency: false - dev: whiteLabel on; docs: white-label.md, AGENT.md, ipal-reference/setup/upgrade Co-Authored-By: Claude Opus 5.5 <[email protected]>
150 lines
8.5 KiB
Markdown
150 lines
8.5 KiB
Markdown
# white-label — admin panel branding from the admin panel
|
||
|
||
The admin panel shows the **client's brand** (logo + name) on the login screen and in
|
||
the navigation, taken from **SiteSettings** — i.e. set by the editor in the admin panel,
|
||
not hard-coded. Each client logs in to "their own" panel.
|
||
|
||
Related: [security.md](./security.md) (adminRoute), [accessibility.md](./accessibility.md).
|
||
|
||
## Turning it on
|
||
|
||
```ts
|
||
// payload.config.ts
|
||
ipalKit({
|
||
i18n: { /* … */ },
|
||
whiteLabel: true,
|
||
})
|
||
```
|
||
|
||
`true` wires branding from the default SiteSettings fields: `logo` (panel logo),
|
||
`favicon` (small navigation icon), `siteName` (name / text fallback).
|
||
|
||
> **After turning it on, run `pnpm generate:importmap`.** The plugin injects
|
||
> `admin.components.graphics.Logo/Icon` pointing at `@intecion/ipal-kit/admin`;
|
||
> Payload must regenerate the import map to find them. Without this step the panel
|
||
> uses the default Payload logo.
|
||
|
||
## Configuration (optional)
|
||
|
||
```ts
|
||
whiteLabel: {
|
||
settingsSlug: 'site-settings', // global settings slug
|
||
nameField: 'siteName', // name field
|
||
logoField: 'logo', // upload for the large logo (login screen)
|
||
iconField: 'favicon', // upload for the nav icon
|
||
titleSuffix: ' · Acme Admin', // browser tab title suffix (static)
|
||
credit: true, // vendor credit under the navigation (default on)
|
||
}
|
||
```
|
||
|
||
| Option | Default | Description |
|
||
|---|---|---|
|
||
| `settingsSlug` | `'site-settings'` | slug of the settings global |
|
||
| `nameField` | `'siteName'` | text fallback (localized → current locale, then the first available) |
|
||
| `logoField` | `'logo'` | `graphics.Logo` → `AdminLogo` |
|
||
| `iconField` | `'favicon'` | `graphics.Icon` → `AdminIcon` (max 28×28 px) |
|
||
| `titleSuffix` | none (`adminMeta` builds one from the site name) | static `admin.meta.titleSuffix`, wins over `adminMeta` |
|
||
| `credit` | `true` | `false` or `{ text?, url? }` |
|
||
|
||
The plugin overrides `admin.components.graphics.Logo` / `Icon` from the project config (its
|
||
values win over yours); `afterLogin` / `afterNavLinks` are appended.
|
||
|
||
## Technology support credit — "Technology support: Intecion.com"
|
||
|
||
A discreet line **"Technology support: Intecion.com"** (pl `Wsparcie technologiczne: Intecion.com`,
|
||
a link to `https://intecion.com`) appears in **two places**:
|
||
- **under the panel navigation** (`afterNavLinks`, variant `nav` — left-aligned),
|
||
- **at the bottom of the login screen** (`afterLogin`, variant `login` — centered).
|
||
|
||
It credits who supports the technology — the client's brand still owns the logo and name.
|
||
The agency comes from the top-level `agency` option (default `{ name: 'Intecion.com', url: 'https://intecion.com' }`),
|
||
the same one the panel's link preview uses (below).
|
||
|
||
On by default with `whiteLabel`. Control:
|
||
|
||
```ts
|
||
ipalKit({ agency: { name: 'Studio X', url: 'https://studio.example' } }) // another agency, everywhere
|
||
ipalKit({ agency: false }) // no agency anywhere
|
||
whiteLabel: { credit: false } // hide the line (both places)
|
||
whiteLabel: { credit: { text: 'Powered by Intecion', url: 'https://intecion.com' } } // own text/url
|
||
```
|
||
|
||
The default text follows the admin language (key `brandingCredit`, `{{agency}}` placeholder);
|
||
override it per language in `i18n.translations.<lang>.ipal.brandingCredit`.
|
||
|
||
## Link previews and search engines — `adminMeta` (on by default)
|
||
|
||
A pasted `/admin` link (Slack, Messenger, Teams…) used to show "Payload App" and Payload's generic
|
||
image. The plugin now fills the panel's `<head>` from Site settings, **with or without `whiteLabel`**:
|
||
|
||
| Piece | Default | Turn off / override |
|
||
|---|---|---|
|
||
| robots | `noindex, nofollow` on every panel page | `adminMeta: { robots: false }` or `{ robots: { index, follow } }`; your `admin.meta.robots` wins |
|
||
| title suffix | `— <site name> \| Panel` | `adminMeta: { titleSuffix: '· {site} admin' }` or `false`; `whiteLabel.titleSuffix` / your `admin.meta.titleSuffix` win |
|
||
| `og:site_name` | the site name | your `admin.meta.openGraph.siteName` wins |
|
||
| description | "Administration panel of <site>. Built on Payload CMS, technology support: Intecion.com." (Polish when the site's default locale is `pl`) | `adminMeta: { description: 'Panel of {site}' }` (string or `{ en, pl }`), `false`; `language: 'en' \| 'pl'`; your `admin.meta.description` wins |
|
||
| preview image | `GET /api/ipal/admin-og` — 1200×630 PNG: the site's logo (or name), "Administration panel", "Technology support: Intecion.com" | `adminMeta: { image: '/my-og.png' }` or `false`; your `admin.meta.openGraph.images` wins |
|
||
| icon | `GET /api/ipal/admin-icon` — redirects to the site's favicon, or draws the initials | `adminMeta: { icons: false }`; your `admin.meta.icons` win |
|
||
| everything | on | `adminMeta: false` = Payload's defaults |
|
||
|
||
- **How:** Payload builds every panel page's metadata from `config.admin.meta`. The plugin sets the
|
||
static parts at config time and fills the site-name parts on start and after every Site settings save
|
||
(`syncAdminMeta`). Keys you set in `admin.meta` are never touched.
|
||
- **The image** is drawn on the server with `next/og` (no external service, cached 1 h). The logo is
|
||
read from the upload itself: PNG, JPG, GIF or SVG; a WebP/AVIF logo falls back to the site name.
|
||
The image endpoints are public (link previews fetch without a session) and show only the logo and
|
||
name the site shows anyway. Fields: `whiteLabel.settingsSlug` / `nameField` / `logoField` / `iconField`.
|
||
- **No import map step** — no new admin components (endpoints only).
|
||
- **Search engines:** besides the `noindex, nofollow` meta, `getRobots()` already disallows `/admin`
|
||
(and `/api`) in robots.txt; `IPAL_NOINDEX=1` adds `X-Robots-Tag` to every response on staging.
|
||
- **Building blocks:** `buildAdminMeta`, `adminMetaForSite`, `syncAdminMeta`, `buildAdminImageEndpoints`,
|
||
`DEFAULT_AGENCY`, `ADMIN_META_TEXTS`; types `AdminMetaOptions`, `AgencyOption`, `ResolvedAdminMeta`.
|
||
- **Verify:** `curl -s $URL/admin/login | grep -E 'og:|robots|<title'` → `noindex, nofollow`,
|
||
`og:site_name` = the site name, `og:image` = `/api/ipal/admin-og`; open `$URL/api/ipal/admin-og` → the
|
||
preview image; paste the link in Slack → the site's name and image.
|
||
|
||
## Logo on the login screen
|
||
|
||
`AdminLogo` is the LARGE logo on the login screen (Payload uses `graphics.Icon` for
|
||
the small icon in the navigation). It renders quite a bit larger (`maxHeight 120 / maxWidth
|
||
420`), so the client's brand is clear at login. The small nav icon is `favicon`
|
||
through `AdminIcon`.
|
||
|
||
## How it works
|
||
|
||
- `AdminLogo` / `AdminIcon` are **Server Components** that read SiteSettings at
|
||
render time through the `payload` instance Payload itself passes to admin
|
||
components (no `@payload-config` import), with `depth: 1` and the panel's current locale.
|
||
- **Safe fallbacks:** when the database is unavailable (login screen before the
|
||
DB is up, a build without a database) or no logo is set → the component shows the
|
||
name (`siteName`), and when that is missing too → `null` (Payload defaults). It never
|
||
throws, never blocks the panel.
|
||
- **A0:** no client brand in code. Logo and name come from the admin panel; if nothing
|
||
is set, nothing is imposed.
|
||
|
||
## Limits
|
||
|
||
- **`whiteLabel.titleSuffix` is static** (config time). Without it, `adminMeta` builds the suffix from
|
||
the site name in Site settings and refreshes it after every save.
|
||
- **This is panel branding, not the front end** — you build the public site's look as before
|
||
(blocks, project styles). White-label applies only to the admin panel.
|
||
- Set the panel path (`/admin → /its`) separately with `adminRoute` — see
|
||
[security.md](./security.md).
|
||
|
||
## Checklist
|
||
|
||
- [ ] `ipalKit({ whiteLabel: true })`
|
||
- [ ] The editor uploaded `logo` and `favicon` in SiteSettings (+ `siteName`)
|
||
- [ ] `pnpm generate:importmap`
|
||
- [ ] Restart dev / rebuild → the panel shows the client's brand on login and in the nav
|
||
|
||
## Turn off, override, extend
|
||
|
||
- **Turn off:** without `whiteLabel` (default) the panel has Payload branding; `credit: false` hides the credit;
|
||
`agency: false` removes the agency everywhere; `adminMeta: false` restores Payload's link preview.
|
||
- **Override:** other fields / global (`settingsSlug`, `nameField`, `logoField`, `iconField`), credit text and URL,
|
||
`titleSuffix`. With `whiteLabel` on, the plugin overrides `graphics.Logo` / `Icon` from the project
|
||
config — set your own graphics components without `whiteLabel`.
|
||
- **Extend:** `AdminLogo`, `AdminIcon`, `IntecionCredit` (props `agency`, `text`, `url`, `variant`) from
|
||
`@intecion/ipal-kit/admin` can be wired manually into `admin.components` with your own `serverProps`.
|