Language

Export and reuse

Exporting theme packages by version, recomputable digests, the preview image bound to content, and why export does not include content and site configuration.

Themes do not have to live on this one machine. Export → upload on another machine → enable and publish; this path is part of the product, and it exists for a practical reason: the same brand appearance has to serve multiple sites, and "if you break it in editing, you must be able to roll back to that one package that worked".

What an export gives you

GET /api/v1/themes/{slug}/export downloads a <slug>-<version>.tar.gz that contains the complete file set of that one version: the manifest, templates, assets and the preview image. There are three key points.

First, it exports by version, not "the current theme directory". When several versions of the same theme coexist, you have to say which version you are taking; the published snapshot pins precisely that version's string of content digests. Second, the digest is recomputable: the file names are sorted and compressed together with the content into a SHA-256, so the same theme yields the same digest on different machines — this is the only way to ask "are the themes on the two sites the same one". Third, the preview image is bound to the content: the preview image itself is excluded when computing the source digest, and the manifest records which source digest this image corresponds to. The point of the binding is to prevent "image from version A, content from version B" — with that kind of package, the card shows a nice old image after upload, but something else is installed inside.

What uploading back checks

Uploading goes through another address and requires install-type permissions. It verifies: the manifest parses strictly (unknown fields are rejected outright), the declared file set corresponds one-to-one with the actual bytes, paths must be relative to the package root (parent-directory traversal or absolute paths are rejected the moment they unpack), templates must pass Go's template parsing, and the digest must match. The preview image has its own set of criteria: PNG or JPEG, no larger than 1 MiB, valid dimensions and encoding, and the extension consistent with the actual encoding. If any item fails, the whole package does not go in — there is no state where half a theme gets registered.

The preview-image slot also has two separate states to tell apart: this version has no preview image (404, so the UI draws no card image) and the preview image is broken (409, explicitly reporting "preview corrupted"). If the latter is rendered as the former, operators will think the author forgot to attach an image.

Version rules when reusing

When uploading the package to a site that already has a theme with the same name, the version number must be higher than every version already in the store; for built-in themes it must also be higher than the version embedded in the binary, otherwise startup replay will overwrite it. This is not being difficult: editing an already-registered version in place would make everything that references it (snapshots, recovery points) point at bytes whose content has changed.

To customize based on a built-in theme, the right entry is to copy it into a new non-built-in theme and then edit — not to edit the built-in one directly. That way the built-in theme always keeps a "factory reset" reference, and your customization has its own identifier and version line.

What export does not include

It does not include content, site configuration, translations, navigation or categories. It is one version of the appearance layer, not a backup of the site. To move a whole site, use the backup and whole-site archive path (an archive includes the database, uploads, themes, plugins and the trust store, and the certificate cache). This boundary is worth stating clearly, because "I exported the theme, so the site can be rebuilt" is wrong — content is the site's substance; the theme is only the clothes it wears.

A practical suggestion

Before going live, export the theme package as it is at that moment and keep it. Its value is not "installing it again" but having a known-good byte set when something goes wrong: if you changed some CSS and found the foreign-language pages look odd, rolling back to the previous theme version only needs uploading that package and clicking enable and publish once — instead of recalling line by line in the editor what you changed. Remember to click publish after changing styles — storing a version is not the same as going live.