Build and preview
Make a read-only token, build the portal from the API, and look at it on your machine before it goes live.
You build a portal from the API with a service account's token. The build reads the released content once and writes a folder of plain files. Run it again after each release.
Prepare a token
- Choose the audience the portal is for, an audience level of
openfolia.yaml(in the sample content,public). One build serves one audience. - Make a service account whose roles hold only
content.read, each with an audience limit of at most that level (see Service accounts and tokens), and copy its token.
The build refuses a token that is no service account's, holds anything but content.read, or may
read above the audience. It checks every manual and module again as it reads them, so nothing
above the audience reaches the files.
Build it
From a checkout of the repository:
CCMS_PORTAL_API_URL=https://docs.example.com/api \
CCMS_PORTAL_TOKEN="$PORTAL_TOKEN" \
CCMS_PORTAL_AUDIENCE=public \
pnpm nx run portal:site| Setting | What |
|---|---|
CCMS_PORTAL_API_URL | The API's address, https:// (plain http only to this machine). Required. |
CCMS_PORTAL_TOKEN | The service account's token. Sent only in the Authorization header. Required. |
CCMS_PORTAL_AUDIENCE | The audience level. Required. |
CCMS_PORTAL_LANGUAGES | The languages, comma-separated (default: every configured language). |
CCMS_PORTAL_RELEASES | Release IDs, comma-separated (default: each product's newest release not withdrawn). |
CCMS_PORTAL_OUT_DIR | Where the sites are written (default: frontend/portal/dist). |
CCMS_PORTAL_BASE_PATH | The path the sites are served under, starting and ending with / (default: /). |
CCMS_PORTAL_BRANDING | on (default) or off: the organisation's branding, or OpenFolia's default look. |
The output holds a folder per language (en/, de/) and an index.html that sends readers to
the first. It replaces the output folder only once every language is built. Before that, the build
searches every file for the token and fails on a match, and it fails when an image's or
attachment's bytes do not match their hash.
Preview it locally
Serve the output folder with any static file server. This one needs only Node:
npx serve frontend/portal/dist -l 4330Then open http://localhost:4330. The start page sends you to the first
language, and you can browse, filter, search and switch variants as readers do. Stop the server
with Ctrl+C. If the port is taken, serve picks another and prints its address:
open that one.
If you built into another folder with CCMS_PORTAL_OUT_DIR, serve that folder instead. Preview a
build made with the default base path /: a portal built for another base path expects to be
served under it.
A preview server is for looking, not for hosting. It does not send the headers the portal needs in production, so the page can look slightly different from the live one. See Hosting the portal for those.