Skip to content
DocsFor version 1.1.x

The content editor

The short version: Connect GitHub, or npm run setup.

A content editor at /admin/, so you and your editors can manage the directory without touching files. It’s Sveltia CMS, a free, open-source app that runs in the browser and saves to your GitHub repository, so the site stays static and every change is a commit you can see and undo. It’s off by default (cms.enabled).

What you can edit:

  • Listings, with their logos;
  • categories, tags, regions and integrations;
  • the attribute definitions;
  • placements (Editor’s picks and sponsored spots);
  • collections (curated lists);
  • every directory page’s copy;
  • the long-form pages: how you review, your policies, privacy and terms, the media kit.

The forms are generated, never written by hand. Each one comes from the schema the build checks against (src/lib/directory/schema.ts and the files beside it) and from directory.config.json, so when you add an attribute, a category or a field, the CMS shows it after the next deploy. If a schema field has no form field, the build stops and names it, so the CMS can’t drift from what the site accepts. The code is in src/lib/cms; /admin/config.json is the result.

Turning it on. In directory.config.json:

"cms": {
"enabled": true,
"route": "admin",
"repository": "",
"branch": "",
"auth": { "methods": ["token", "oauth"], "scope": "repo" },
"editorialWorkflow": ["listings", "placements"],
"labelPrefix": "sveltia-cms",
"skipCi": false,
"previewContext": ""
}
  • repository and branch: where it saves. Empty means submissions.repository and submissions.baseBranch, so you usually set them once, there. With neither set, the CMS works only on npm run dev, on your own copy (“Editing on your own machine” below), and a build leaves /admin/ out with a warning, so you can try it before you connect GitHub. On a host’s build (Cloudflare, Netlify, GitHub Actions), both empty means the repository the site was built from: the build finds it by itself (scripts/directory/detect.mjs; it never takes the product’s own template), so a site started from the template needs nothing typed here.
  • auth.methods: how editors sign in (below). auth.scope is repo, or public_repo for a public repository.
  • editorialWorkflow: the collections whose changes can go through a pull request (Draft → In review → Ready → Publish) instead of saving straight to the branch. Listings and placements by default, because that’s where the submission pipeline’s and the paid bookings’ pull requests arrive (the submission pipeline), so you review them in the CMS. Empty: every save commits directly, and there’s no board.
  • directPublish (One-click publishing; default true, and the owner sets it in the editor: Settings → Features → One-click publishing, directPublish in src/config/settings/features.json): every collection saves straight to the branch, so Save puts a change live and Delete takes a listing off the site, and only pull requests (submissions, paid bookings) wait on the board. Off: listings and placements go through the board. A copy made before 1.1.0 keeps the flow it had (off) until the owner turns it on. See “Reviewing in the CMS” below.
  • skipCi: adds [skip ci] to draft saves, so a draft doesn’t start a build.
  • previewContext: the status check whose link is a pull request’s preview, if the CMS doesn’t find it by itself (e.g. Workers Builds).

Editors need write access to the repository. Whatever saves straight to main (with One-click publishing, everything; without it, categories, tags, attributes and page copy) also needs a place on the ruleset’s bypass list, where there’s a ruleset (“Reviewing in the CMS” below). Choose either or both sign-in methods:

  • An access token (simplest, and recommended if you edit alone):

    1. On GitHub, create a fine-grained token: Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token.
    2. Set Repository access to this one repository.
    3. Set Contents and Pull requests to Read and write.
    4. Optionally, add Deployments and Commit statuses (read-only), so the CMS can link each pull request’s preview.
    5. On /admin/, choose Sign In Using Access Token and paste it. It stays in that browser only.
  • Sign in with GitHub. Each editor signs in with their own GitHub account, in one click. Until it’s set up, the editor’s Sign In with GitHub button opens Set up your site at Connect GitHub (/admin/setup.html, src/lib/cms/setup-page.ts), which:

    1. creates a private GitHub App from a prefilled manifest (Contents and Pull requests read and write; Checks, Actions and Metadata read; no webhook; its callback https://<the site>/api/cms/callback; on the repository owner’s account or organisation), and shows its values once: the Client ID and client secret for sign-in, and the App ID and private key the submission pipeline and the sponsorship webhook write with;
    2. links to installing it on the site’s repository only, and reads the installation ID;
    3. lists the five keys for your host, CMS_GITHUB_CLIENT_ID, CMS_GITHUB_CLIENT_SECRET, GITHUB_APP_ID, GITHUB_APP_INSTALLATION_ID and GITHUB_APP_PRIVATE_KEY, each to add as a secret (on Cloudflare, the Worker’s runtime variables, as Secret, never plain text and never in wrangler.jsonc; or npx wrangler secret put …).

    The sign-in runs in the site’s own function (/api/cms/auth; the other hosts’ adapters are under Other hosts); without functions on your host, use the token method. A GitHub App’s sign-in reaches only the repositories it’s installed on, and lasts 8 hours. Before handing it over, the site checks the account can push to the repository, and tells anyone else plainly that they don’t have access. A GitHub OAuth App (client_id and secret in the same two variables) also works, but its sign-in reaches every repository the editor can.

The submission pipeline’s and the paid bookings’ pull requests arrive on the Editorial Workflow board (the third button at the top left), labelled sveltia-cms/pending_review, under In Review. What else goes there depends on One-click publishing (cms.directPublish, Settings → Features):

  • One-click publishing on (the default for a new site): every collection saves straight to the branch (publish_mode: simple in the generated config), so Save is live in about 3 minutes and ⋮ → Delete takes a listing off the site the same way. The board has only the review stage (stages: ['draft', 'pending_review'] in src/lib/cms/sveltia.ts), where Sveltia offers Publish: open a submission, Save any change, then Publish (it merges the pull request). To turn one down, delete it there, or close its pull request.
  • One-click publishing off (for a team that reviews each other’s work): saving a listing or a placement opens a pull request, and the board shows it as a card:
    1. Draft: work in progress.
    2. In Review: where the pipeline’s pull requests arrive.
    3. Ready: moving a card here (or setting its Status to Ready) approves its pull request for you. That’s the approval the ruleset asks for (the pipeline’s step 1).
    4. Publish: merges it, and the site rebuilds. A deletion waits on the board too, until it’s carried out there, and the listing says so.

Categories, tags, regions, integrations, attributes, collections and page copy always save straight to the branch (Sveltia CMS can’t review single files, and collections aren’t in editorialWorkflow). With the ruleset from the pipeline’s step 1, only someone on its bypass list can do that, so an editor with the Write role can’t save those collections (GitHub refuses the commit, and the CMS shows the error), and, with One-click publishing on, can’t save anything: they need it off, to save listings and placements as drafts for you to publish.

  • Just you, or editors you’d make admins anyway: nothing to do. The Repository admin role is on the bypass list.
  • Editors who aren’t admins: create a team for them (Organization → Teams), give it Write access, and add the team to the ruleset’s bypass list (Add bypass → the team → Always). Their direct saves to main then go through, and nobody else’s do. Personal repositories can’t have teams: there, add the editors as admins or keep those edits to yourself.
  • Don’t widen the bypass list to the Write role: that would let anyone with Write access, and the pipeline’s GitHub App if it had it, skip the approval.

Previews: if your host builds branches, each pull request gets a preview, and the CMS links to it from the entry.

  • Cloudflare Workers Builds: turn on builds for non-production branches.
  • Netlify and Vercel: they do this by default.

Preview links are public on every host unless you protect them (for example, with Cloudflare Access).

Previews of submissions are off by default (submissions.previews, or Settings → Submissions → Advanced → Previews of submissions). Each commit the pipeline makes ends with the line Directory-Submission: unreviewed; on a host’s preview build whose last commit carries it, npm run build (scripts/directory/build.mjs) writes a one-page site saying so instead of building the stranger’s listing and processing their logo, and the check stays green. Once the owner saves a change in the editor, the last commit is theirs and the preview builds as usual. Turned on, previews are built from what a stranger sent, before you’ve looked at it: usually fine (the build only resizes the image, and the page carries the site’s Content-Security-Policy). To save the builds as well, skip the submission branches (cms/listings/*) at the host:

  • Cloudflare Workers Builds: the Worker → Settings → Build → Branch control. Set non-production builds to exclude cms/listings/*.
  • Netlify: in netlify.toml, under [build]: ignore = "case \"$HEAD\" in cms/listings/*) exit 0;; *) exit 1;; esac".
  • Vercel: Project Settings → Git → Ignored Build Step, with the command [[ "$VERCEL_GIT_COMMIT_REF" == cms/listings/* ]] && exit 0 || exit 1.

On npm run dev, open /admin/ in Chrome or Edge and choose Work with Local Repository. Pick this project’s folder, and the CMS edits your working copy directly, with no sign-in and nothing sent anywhere. Commit when you’re happy.

  • No repository needed: with cms.enabled on and no repository set, this is the only way in, and the admin page says so in a note. Only the access-token sign-in is offered, and it needs the repository.
  • The folder must be a Git repository. The CMS refuses one without a .git folder (“not a repository root directory”). If you started from a download rather than a clone, run git init in the project’s folder first.
  • Browsers: local mode needs Chrome, Edge or another Chromium browser. Firefox and Safari can’t open a folder this way.
  • Saving changes the files only, with no review workflow (listings and placements save straight away). To have each save committed too, turn on Settings → Developer → Git Commits in the CMS. That needs your name and email set in the repository’s own Git configuration (git config user.name "…" and git config user.email "…" in the project’s folder), because the CMS can’t read your global one.

/admin/ holds:

  • the admin page;
  • a start script (start.js);
  • the generated config.json;
  • status.json, written by each build: the commit the live site was built from, the host, the listings’ facts and link results, and the build’s notes, for the editor’s notes and its Site status panel (src/lib/cms/site-status.ts). It’s public, so it holds nothing private;
  • Sveltia CMS itself, from node_modules/@sveltia/cms. The version is pinned in package.json, and the bundle is never loaded from a CDN.

Site status (the button beside Steps) is built only from what the editor already reads: status.json, GitHub with the editor’s own sign-in (the latest saves, the daily rebuild’s runs, open submissions and paid bookings, placements, the settings files), and /api/cms/status for signed-in editors (the keys, Stripe’s mode and permissions, and this copy’s version against the latest release). The latest release comes from the docs site’s /latest.json ({ "version", "date", "notes" }, at product.docs in directory.config.json), which the site’s function reads at most every six hours (src/lib/cms/release-check.ts); the editor’s own policy doesn’t change.

The folder’s own headers (dist/_headers; Cloudflare and Netlify read it). The policy is also a <meta> on the admin page, so it applies on every host. Only “frames refused” needs the header (on Vercel and a Render static site, npm run setup:host-files writes it into vercel.json or render.yaml):

  • A strict Content-Security-Policy: the CMS’s scripts only (CMS_CSP in src/lib/cms/index.ts). Connections go only to GitHub (its API, *.githubusercontent.com and its status page), and, when an owner saves a newsletter form, to Kit’s and beehiiv’s form addresses, read once for the form’s number or ID. Fonts load from jsDelivr, for the CMS’s interface and icons.
  • noindex.
  • Frames refused.

The CMS’s update check against unpkg.com stays blocked on purpose: upgrade by changing the version in package.json, then run npm run qa:cms and npm run cms:e2e. robots.txt disallows the folder, and it’s never in the sitemap.

Optional extra hardening: the CMS on its own subdomain. Editors who sign in keep their GitHub token in that browser’s storage for the site’s origin. Every page of the site shares that origin. The site’s own protections stop a script in a listing or page from running (Markdown links are checked as pages are built, and every page has a Content-Security-Policy). If you want a second wall, serve the CMS from its own origin, such as cms.example.com, so that even a script that got through on the public pages couldn’t reach the token:

  1. Deploy the same build a second time, as a separate project or Worker, on cms.example.com. Only /admin/ (and /api/cms/* for GitHub sign-in) needs to work there.
  2. Add https://cms.example.com/api/cms/callback to the sign-in app’s redirect URIs: in the GitHub App’s settings, under Identifying and authorizing users, Add redirect URI, and keep the one already there (GitHub’s help).
  3. Editors bookmark https://cms.example.com/admin/. On the main site, the folder can stay, or redirect there.

It’s not the default because it means a second deployment to keep in step. The starter works safely without it.

The public config names your repository. Anyone can read /admin/config.json, and it includes backend.repo (owner/name), because the CMS needs it before anyone signs in. For a private repository that reveals only the name: nobody can read or change the contents without access. If even the name is sensitive, choose one that gives nothing away.

Long-form pages and comments: see Content files and the CMS.

  • npm run qa:cms checks, with nothing on GitHub:

    • The config: it’s generated, Sveltia’s own schema accepts it, and every schema field has a form field.
    • Saving: the real CMS, run on copies of your content files, changes exactly the edited line in each kind of file.
    • The headers: no Content-Security-Policy violation.

    qa:quick runs it when the CMS, a schema or the content changes, and qa:full always does.

  • npm run cms:e2e runs it against a real GitHub test repository (TEST_GITHUB_REPO and TEST_GITHUB_TOKEN, in your shell or .env.test):

    1. It copies your content files there.
    2. It signs in with the token and checks that every collection loads.
    3. It edits a listing, and checks that the result is a pull request changing only that line.
    4. It cleans up.

    It refuses any repository whose name doesn’t say test, sandbox, e2e or scratch.

These docs describe SixtyList 1.1.x.