Русский

HOBA

Media, assets, and references

Separate managed media, theme assets, and external URLs: they have different validation rules and different fates in a release.

Three kinds of reference

A block can reference managed media as media/<id>, a theme can reference a declared asset as asset:key, and an external HTTP(S) address stays external. Core does not fetch an external URL or copy it into the release snapshot. In a graph theme, Image requires a declared managed asset, so asset:key is not shorthand for an arbitrary URL. og_image accepts asset: or HTTP(S).

Upload and validation

POST /api/v1/cms/sites/{site_id}/media accepts JSON {filename, mime_type, content_base64}. PNG, JPEG, GIF, WebP, SVG, and AVIF are allowed up to 5 MiB after decoding; WOFF2 is allowed up to 2 MiB. Empty content, an unsupported type, a file signature that does not match mime_type, or a filename with a path separator or control character is rejected. The global JSON limit is 8 MiB, so base64 adds roughly one third to the payload.

Variants and addresses

For a raster image, Core builds the widths 320/640/960/1280/1600 once, but only widths strictly below the source: there is no upscaling. Each variant is re-encoded in the source format and gets the address media/<variant-sha256>@<width>.<ext>. The original is stored as media/<sha256>.<ext>; identical bytes produce one artifact and different bytes cannot collide. SVG and undecodable images simply have no variants, which is not an error.

Draft, publication, and deletion

A reference missing from the snapshot stops planning with a precise error; a broken storage reference stops publication before the release is written. Publication embeds the bytes in the snapshot, so deleting or replacing media does not change an already published release. Deletion is safe for the published version but breaks a draft that still references the asset. Duplicate filenames are allowed and create distinct assets.

Metadata and restore

Media identity and bytes are immutable; only display_name and alt are editable. Write alt text for the meaning in the page context, and treat dimensions and variants as hints rather than a replacement for layout. In local storage, never overwrite a file in place: releases may share an inode through a hard link. Restore into a fresh media root and switch the root; temporary stage files are not content.