Skip to content

Managing content in the admin UI

The content editor is Sveltia CMS. It runs beside the dev server and edits the same Markdown files that live in git.

Open it

Start the dev server and go to http://localhost:4321/admin/index.html in Chrome, Edge or Brave — the full filename, not /admin/. Click Work with Local Repository and pick the repository root.

The sidebar lists three collections:

  • Pages · Guidessrc/content/docs/<locale>/guides/.
  • Pages · Referencesrc/content/docs/<locale>/reference/.
  • Blog postssrc/content/blog/<locale>/.

Create a post

  1. Pick Blog posts, then New entry.
  2. Type a title. The slug is filled in for you, and you can edit it.
  3. Fill in the description, the publish date and the tags.
  4. Write the body in the editor. It saves as normal Markdown.
  5. Press Create. The file appears in src/content/blog/en/.

Leave Draft ticked while the post is unfinished. Drafts show up in npm run dev and are skipped by npm run build.

Translate it

You do not create a second entry. Every entry opens with all three languages side by side, so type the Chinese title next to the English one and one save writes both files.

Some fields are shared rather than translated — the publish date, the author, the tags. Those show as read-only outside English, because English owns the value.

Commit the change

The editor writes files, it does not commit them:

Terminal window
git status
git add src/content/blog
git commit -m "blog: add post about the editor"

Pointed at a GitLab project instead of your working copy, a save becomes a branch and a merge request for someone to review.

One thing to watch

The editor only keeps the frontmatter fields listed in public/admin/config.yml. If you add a field by hand and it is not in that file, the next save in the editor removes it.

That file is generated, so the fix is to add the field to src/lib/blog-schema.ts (posts) or src/lib/docs-schema.ts (pages) and run npm run sveltia:config. npm run validate fails if you forget.


← All posts