Skip to content

Configure Sveltia

Sveltia CMS is generated from site.config.yaml. The old public/admin/config.yml file is no longer edited by hand.

FrontMark exposes generated admin files:

URLPurpose
/frontmark/admin/config.jsonJSON config loaded by Sveltia.
/frontmark/admin/config.ymlYAML view of the same generated config.
/frontmark/admin/sveltia-cms.jsSveltia bundle from @sveltia/cms.

The default build is static. In that mode, these files are generated at build time and Sveltia uses Forgejo OAuth through the dedicated OAuth/API proxy. Token sign-in remains available as a fallback method.

Configure the public site, the Forgejo instance and the OAuth application in one file:

site:
base: /frontmark
url: https://example.com
git:
provider: forgejo
origin: https://yourgitinstance.example.com
repository: sigMAX/Image_frontmark
repositoryUrl: https://yourgitinstance.example.com/sigMAX/Image_frontmark
branch: main
appId: 00000000-0000-0000-0000-000000000000

These fields generate the Sveltia backend values:

site.config.yaml fieldGenerated Sveltia fieldExample result
git.repositorybackend.reposigMAX/Image_frontmark
git.branchbackend.branchmain
site.url + site.basebackend.api_roothttps://example.com/frontmark/api/forgejo/v1
site.url + site.basebackend.base_urlhttps://example.com/frontmark/oauth/forgejo
admin.authEndpointbackend.auth_endpointlogin/oauth/authorize
git.appIdbackend.app_id00000000-0000-0000-0000-000000000000
admin.authMethodsbackend.auth_methodsoauth, token

Sveltia receives values equivalent to:

backend:
name: gitea
repo: sigMAX/Image_frontmark
branch: main
api_root: https://example.com/frontmark/api/forgejo/v1
base_url: https://example.com/frontmark/oauth/forgejo
auth_endpoint: login/oauth/authorize
app_id: 00000000-0000-0000-0000-000000000000
auth_methods:
- oauth
- token

OAuth is the primary method. To build a direct-token-only CMS config for an environment without the OAuth proxy, set SVELTIA_BACKEND_MODE=direct during the build.

Sveltia opens the Forgejo authorization page in a popup, then exchanges the returned code for an access token. Direct browser calls to the Forgejo token endpoint can fail because of CORS or because the OAuth app uses a confidential client secret. FrontMark supports that flow with the dedicated Dockerfile.oauth container.

The real Forgejo instance is:

https://yourgitinstance.example.com

The generated CMS config uses these public routes:

Sveltia URLForwarded to
https://example.com/frontmark/api/forgejo/v1/*https://yourgitinstance.example.com/api/v1/*
https://example.com/frontmark/oauth/forgejo/login/oauth/authorizehttps://yourgitinstance.example.com/login/oauth/authorize
https://example.com/frontmark/oauth/forgejo/login/oauth/access_tokenhttps://yourgitinstance.example.com/login/oauth/access_token

With the dedicated proxy container, route /frontmark/oauth/forgejo/* and /frontmark/api/forgejo/v1/* to Dockerfile.oauth, and route the rest of /frontmark/* to the static site container. The proxy accepts both Traefik layouts: with /frontmark preserved or stripped before the request reaches the container.

If the Forgejo OAuth application requires a secret, mount it only on the proxy container:

Terminal window
GITEA_CLIENT_SECRET=...

The static site container does not need this secret.

Create or update the OAuth application in Forgejo with the git.appId value from site.config.yaml.

For a hosted site under /frontmark, add this redirect URI:

https://example.com/frontmark/admin/

For local development, add the local callback too:

http://localhost:4321/frontmark/admin/

If the popup opens http://localhost:4321/... on the hosted site, the deployed app is still serving an old generated config. Rebuild and redeploy with:

Terminal window
make rebuild

OAuth checklist:

CheckExpected value
OAuth client id in ForgejoSame value as git.appId.
Hosted callbackhttps://example.com/frontmark/admin/
Local callbackhttp://localhost:4321/frontmark/admin/
Authorization popup on hosted siteStarts with https://example.com/frontmark/oauth/forgejo/login/oauth/authorize.

Collections are configured under admin.collections in site.config.yaml.

admin:
publicFolder: /uploads
collections:
- name: docs
folder: src/content/docs
previewPath: /docs/{{slug}}/

Field mapping:

site.config.yaml fieldGenerated Sveltia fieldNotes
admin.appTitleapp_titleCMS window title.
admin.mediaFoldermedia_folderRepository path for uploaded media.
admin.publicFolderpublic_folderPublic URL path; site.base is added automatically.
admin.logo.srclogo.srcPublic logo path; site.base is added automatically.
admin.slug.encodingslug.encodingSlug encoding strategy.
admin.slug.cleanAccentsslug.clean_accentsConverts accents before slug creation.
admin.slug.sanitizeReplacementslug.sanitize_replacementReplacement character for invalid slug characters.
admin.collections[].previewPathcollections[].preview_pathPublic preview URL; site.base is added automatically.
admin.collections[].fieldscollections[].fieldsPassed directly to Sveltia.

The active site.base is added automatically. With site.base: /frontmark, the generated Sveltia config uses:

public_folder: /frontmark/uploads
preview_path: /frontmark/docs/{{slug}}/

To remove every prefix, set site.base: ""; the generated Sveltia URLs will lose /frontmark automatically.

Run the site and open the generated config directly:

Terminal window
make dev

Then inspect:

http://localhost:4321/frontmark/admin/config.yml

The generated config should contain FrontMark Forgejo proxy URLs:

api_root: http://localhost:4321/frontmark/api/forgejo/v1
base_url: http://localhost:4321/frontmark/oauth/forgejo

For the direct-token fallback, build with SVELTIA_BACKEND_MODE=direct:

Terminal window
SVELTIA_BACKEND_MODE=direct make build