Skip to content

Asset Library ​

Sveltia CMS’s Asset Library allows users to efficiently manage and organize media files, including images, videos and documents. It serves as a centralized hub for all digital assets, making it easy to upload, categorize and retrieve files as needed.

Files can be stored in the Git repository with the internal media storage, or on an external media storage provider such as Amazon S3, Cloudflare R2 or Uploadcare.

The Asset Library showing a grid of photos and the details of a selected imageThe Asset Library showing a grid of photos and the details of a selected image

Features ​

The Asset Library includes the following features:

Folder List ​

The sidebar displays a list of all folders in the repository’s global media folder, as well as any collection-specific media folders. If any cloud storage services are configured, they are also listed in the sidebar under External Locations.

Internal Locations ​

Navigate between the global media folder and collection-specific media folders. This allows organizing assets at both the global level and within individual collections for more granular asset management. Within each of these folders, users can also browse and manage subfolders.

External Locations ​

Assets in external locations are listed under External Locations in the sidebar. This includes any configured cloud storage services, as well as a special location for linked files.

Cloud Storage Services ​

Every cloud storage service configured with the media_libraries option is listed under External Locations in the sidebar, at #/assets/-/{service} — for example #/assets/-/uploadcare. Select a service to browse the files stored there, using the same grid or list views, sorting, type filter and Info pane as a repository folder. A search box narrows the list down by filename.

The user is prompted for the service’s secret key or SAS token the first time, just like in the File and Image field picker. The credential is stored in the browser only, and can be changed later under Settings > Media.

Files can be uploaded, downloaded, renamed, replaced and deleted directly on the service, subject to what its API allows:

ServiceUploadDeleteRenameReplace
Amazon S3, Backblaze B2, Bunny Storage, Cloudflare R2, DigitalOcean Spaces, Neon Object Storage, Scaleway Object Storage, Supabase StorageYesYesYesYes
Azure Blob StorageYesYesYesYes
UploadcareYesYesNoNo
CloudinaryCloudinary’s own Media Library widget is opened instead

The controls for operations a service doesn’t support are hidden. Files can also be moved to another folder on the same service, to another service or to the repository.

Renaming a file on an S3-compatible service or Azure Blob Storage copies it to the new name and then deletes the original. Make sure the bucket’s CORS policy allows the DELETE method and all request headers, and that the credential has the delete permission. See the setup instructions of each service for details.

As with repository assets, the entries linking to a renamed file, or to the files in a renamed folder, are updated with the new URLs in one commit, so their links keep working. The Rename dialog says how many entries will be updated. The rename is refused up front if one of those entries is read-only, or if the changes can’t be committed, as is the case for an Open Authoring contributor. If the entries can’t be saved, the file is renamed back.

Entries linking to a deleted external file are not updated, though, because the file URL is stored as is.

The file list of a large bucket or container is fetched in pages, up to a limit. If the service holds more files than are listed, a notice says that some of them are left out.

INFO

Files on external services are previewed straight from the service’s URL. So the details view can show a text or Markdown file only if the service allows cross-origin requests.

The Info pane shows the file size, the dimensions and duration of media files, the public URL, the file path on the service and the entries using the file. It doesn’t show the Exif metadata, which can’t be read without downloading the file.

The Copy menu offers the public URL, the file path relative to the configured prefix, the service’s file ID (an object key or a UUID) and the file data.

These files are not included in the global search.

Linked Files ​

The last item under External Locations, Linked Files at #/assets/-/linked, gathers every file that a File or Image field links to by URL. That could be a picture hosted on another site, a document on a shared drive, or an avatar served by a third-party API. You can see them all in one place and check where each one is used.

The list is built from the entries themselves, so it needs no configuration and stays in sync as entries are saved. A URL used by several entries is listed once.

Files that live in the repository or on a configured cloud storage service have their own locations, so they aren’t listed here, even when an entry stores them as an absolute URL. Images embedded in Markdown or rich text bodies aren’t scanned either.

Since these files are hosted elsewhere, they can only be browsed: there is no upload, rename, replace or delete.

The Info pane shows the kind, the dimensions or duration of a media file, the URL and the entries using the file. The file size isn’t available. The Copy menu offers the URL and, where the host allows cross-origin requests, the file data.

A URL without a file extension, such as an avatar endpoint, is treated as an image when it comes from an Image field.

A long list is easier to go through host by host: choose Domain from the Group menu in the toolbar to group the files by the domain of their URL. The choice is remembered for this location.

The CMS also checks whether each file can still be loaded. A file that can’t be — because it was deleted, moved or is on a host that is gone — is marked with an Unavailable badge, so a broken link stands out. A missing non-media file on a host that doesn’t allow cross-origin requests can’t be detected, though.

Subfolders ​

A repository folder is browsed folder by folder, the way a file manager works. The subfolders of the current folder are listed ahead of its assets, as compact tiles in the grid view or as rows in the list view. Double-click one to open it, or use a single click or tap on a touch screen or a small screen.

A breadcrumb in the toolbar shows the current location and leads back to any parent folder. The browser’s Back button works as well, since each folder has its own URL, such as #/assets/static/images/2024/summer.

The All Assets location lists every asset at once instead.

Click the empty area of the list, or select a folder with a single click or the keyboard, to see the folder’s path and what it holds in the Info pane.

Folders can be managed like assets:

  • Create a folder with the New Folder button in the toolbar. A Git repository can’t hold an empty folder, so the CMS commits a .gitkeep placeholder file to keep it in the repository until something is uploaded to it. The name is sanitized like a filename, and slugified as well if that option is enabled. It’s rejected if it:
    • contains a slash
    • starts with a dot, which would hide the folder, even if slugification would remove the dot
    • has nothing usable left after sanitization
    • is admin or cms, the folders the CMS itself is usually served from
    • is already used by another file or folder in the current folder, ignoring case
  • Upload files into the current folder: both the Upload button and drag and drop save the files there.
  • Rename a folder from its options menu. The new name follows the same rules as a new folder’s. Every asset in the folder, at any depth, is moved along in the same commit, and the File and Image fields and Markdown images that reference them are updated with the new paths.
  • Delete a folder and everything in it from its options menu. As with deleting assets, the entries referencing any of the assets are updated in the same commit, and the confirmation dialog says how many. The deletion is refused if clearing a reference would break a field’s validation rules.

Subfolder browsing applies to any global, collection or asset collection folder with a fixed path.

Some folders don’t have a single tree to walk, so their assets are listed all at once as before:

A collection media folder nested inside the global media folder is its own location in the sidebar, rather than a subfolder of the global one.

When working with a local repository, a folder that is left empty by a move or deletion is removed from the disk. This way, the local checkout matches what a Git commit would leave.

Open Authoring contributors can browse folders but can’t create, rename or delete them, or move assets, as those changes are committed straight to the branch.

Read-Only Folders ​

The files in a folder the CMS itself may be served from are listed but read-only. That’s a folder named admin or cms, or named like the folder of the admin page you’re using, located either:

  • at the top of the repository
  • right below the folder the site is served from: static or public, or the folder the global media_folder and public_folder options point to

This protects the CMS itself. With a media folder at the root of the public folder, the CMS’s own admin page and configuration file — static/admin/index.html and static/admin/config.yml, for example — would otherwise appear as assets. Replacing them would hand the next user’s sign-in to whoever wrote the new page.

A folder with the same name deeper down, like a page bundle at content/posts/cms, is a regular folder. Only an index.html or config.yml file in it (also .yaml, .toml or .json) is protected, as it could still be an admin page.

In a read-only folder:

  • The files can’t be replaced, edited, renamed, moved or deleted.
  • Nothing can be uploaded to such a folder, and no folder can be created in it.
  • The folder itself can’t be renamed or deleted, and a new or renamed folder can’t be called admin or cms.

The same applies to the picker of the File and Image fields, and to the Editorial Workflow. A pull request that changes a file in such a folder as an asset isn’t published from the CMS. Make changes to the admin page in the repository directly.

Deployment configuration files such as _redirects aren’t affected, and can still be edited through a file collection; see Editing Site Deployment Configuration Files.

Folders on External Locations ​

Amazon S3 and the S3-compatible providers, as well as Azure Blob Storage, store files at paths. So they are browsed folder by folder the same way, with the same breadcrumb, Info pane, New Folder button and folder menu.

Object storage has no folders of its own. The CMS reads the folders off the file paths, and keeps an empty folder with a zero-byte placeholder object named after the folder with a trailing slash. That’s what the consoles of these services do too.

The services can’t move a file, so renaming a folder copies each file to its new path and deletes the original, one file at a time. Deleting a folder deletes each file in it. The entries link to the files on these services by URL, so once every file has been moved, the entries using them are updated with the new URLs in one commit. If a file can’t be moved or the entries can’t be saved, the files moved so far are moved back.

The search box in the location’s toolbar looks through every folder, listing the matches with their paths.

An uploaded file’s name may already be taken in the folder, or by another file in the same upload, such as photo.jpg and photo.png both converted to WebP. The file is then given a number suffix like photo-1.webp, as in the repository, instead of overwriting the file on the service.

Uploadcare has no folders, and Cloudinary handles them in its own widget, so neither is affected.

Asset List ​

Thumbnails are displayed for image, video and PDF files for easy identification. Users can switch between grid and list views, and sort or filter assets by name and file type.

Thumbnails of entries are also displayed in both grid and list views, making it easier to navigate and identify the assets needed.

Asset Upload ​

Upload multiple assets at once by browsing or dragging and dropping files directly into the library, including files in nested folders. When an entry or asset file is deleted, the empty folder that contains it is also automatically deleted, so there is no need to clean it up manually.

The CMS prevents the same file from being uploaded twice by comparing file hashes and selecting an existing asset instead.

Use the search functionality to quickly find specific assets. Assets can also be filtered by name or file type to narrow down results. Files on external locations are searched with the search box in the location’s own toolbar instead.

Asset Details ​

Preview image, audio, video, text and PDF files directly in the Asset Library. Check the site’s Content Security Policy (CSP) if the preview doesn’t work as expected.

View comprehensive asset details including:

  • File size and dimensions
  • Commit author and date information
  • A list of entries that use the selected asset
  • Exif metadata when available, including creation date and GPS coordinates displayed on a map

Asset Management ​

Manage assets with a variety of operations:

  • Rename existing assets. If the asset is used in any entries, the File and Image fields will be automatically updated with the new file path.

  • Move one or more selected assets to another folder, in the repository or on a cloud storage service. See Moving Assets below.

  • Replace existing assets with new versions.

  • Edit plain text assets, including Markdown, JSON, SVG files and other text-based content using the built-in editor.

  • Copy the public URL, file path, text data or image data of a selected asset to the clipboard.

  • Download one or more selected assets at once.

  • Delete one or more selected assets at once. If an asset is used in any entries, those entries are updated in the same commit so that no reference is left dangling:

    • A File or Image field holding the asset is cleared, or loses that item if it holds several files.
    • An image embedding it in a Markdown or rich text field is removed.

    The confirmation dialog says how many entries will be updated. The deletion is refused, though, if clearing a reference would break a field’s own validation rules:

    • a required Image field with nothing left
    • a multi-file field with fewer than min files
    • a required body with nothing but the image

    The dialog then lists the entries and fields in the way, so that they can be updated first. To see what an asset is used by before deleting it, check the Info pane’s Used in list.

Moving Assets ​

Select one or more assets, then choose Move from the Edit Options menu in the toolbar, or from the details view. You can also drag the assets onto a folder or a cloud storage service in the sidebar, or onto a subfolder in the list. Either way, the Move dialog opens, listing the repository folders and the cloud storage services you’ve entered credentials for, each with its subfolders. A folder you dropped the assets on is already selected. The dialog says how many entries use the assets; those entries are updated to point at the new locations, so no link is broken.

Assets can be moved:

  • Between repository folders, including subfolders. The files and the entries using them are updated in one commit. The move is refused if a file of the same name is already in the destination folder. An asset stored next to an entry, in an entry-relative folder, can be moved out of it, and the entry’s relative path is replaced with the asset’s new path. Entry-relative folders and folders whose path contains a template tag can’t be destinations, as an asset’s path there depends on the entry.
  • From the repository to a cloud storage service. The files are uploaded, then deleted from the repository in the same commit that points the entries at their URLs on the service. If the commit fails, the uploaded files are deleted again.
  • From a cloud storage service to the repository. The files are downloaded and saved to the folder like uploads, along with the updated entries, then deleted from the service. Downloading requires the service to allow cross-origin requests.
  • Between cloud storage services, or to another folder on the same service. A move within a service uses the service’s own copy-and-delete operation; a move to another service downloads and uploads each file.

A file moved to or within a cloud storage service, or from one to the repository, is given a number suffix like photo-1.jpg if its name is already taken in the destination folder, as an upload is.

The originals are only deleted once the files are in place and the entries have been saved, so a failure along the way never leaves an entry pointing at a missing file. If only deleting the originals from a service fails, the move still counts as done, and a warning says the originals were left behind.

The move is refused if any entry using the assets is read-only. Assets in a read-only folder can’t be moved, and Open Authoring contributors can’t move assets at all.

Future Plans

Image editing capabilities, such as cropping and resizing, may be added in future releases. Advanced DAM features, such as tagging and metadata management, are also planned for future updates.