Memory 019e8021

Memory ID (Session ID): 019e8021-4f83-7000-8cc4-2af4c0ac7cd7
Last Updated: 2026-06-01 00:51:31

Fact Summary

Sveltia CMS Local GitHub API Shim Setup

Architecture

  • Hugo Knowledgebase at /home/dev/Knowledgebase using hugo-book theme
  • Hugo dev server on :55888
  • HTTPS proxy (https-proxy.mjs) on :55889 using self-signed cert
  • Local GitHub API shim (local-github-api.mjs) on :8082
  • HTTPS proxy routes: /api/v3/* → :8082, /* → :55888

Key Technical Details

  • hugo-book theme uses BookSection param in hugo.toml to control sidebar navigation. Setting BookSection = "*" shows all sections (backward compat converts to ”/”). Default is “docs”.
  • Sveltia CMS requires HTTPS and a GitHub-compatible API. It uses postMessage OAuth flow.
  • OAuth bypass: /admin/index.html includes inline script that auto-posts token via postMessage when auth popup opens, no real GitHub OAuth needed.
  • local-github-api.mjs fakes GitHub REST endpoints: /user, /repos/:owner/:repo, /repos/:owner/:repo/branches, /repos/:owner/:repo/git/trees, /repos/:owner/:repo/contents/*, /repos/:owner/:repo/git/blobs — all backed by local filesystem and git commands.
  • CMS config (static/admin/config.yml) points backend to base_url matching the HTTPS proxy origin, with api_root set to the same origin + /api/v3.

Certificates

  • User dv has certs at /home/dv/certs/0rk-dev.{crt,key} but key is only readable by dv user.
  • Generated self-signed cert for dev user instead.

Systemd Services

  • hugo-knowledgebase.service: Hugo dev server
  • hugo-kb-https-proxy.service: HTTPS proxy
  • local-github-api.service: GitHub API shim

Pitfalls

  • Sveltia CMS (unlike Decap CMS) does NOT support decap-server/local backend proxy. Must fake full GitHub API.
  • hugo-book theme sidebar only shows one section by default (BookSection param). To show all sections, remove BookSection or set to ”*”.
  • Both guide markdown files had identical titles (“Repository Guidelines”) causing confusion in navigation — titles in frontmatter need to be unique/descriptive.
  • Self-signed certs require browser warning acceptance on first visit.

Reference Session