Context
I am using Sveltia CMS in an Astro project.
Astro supports two locations for static files:
- Files inside
src/ can be imported by Astro components or referenced in content collections.
- Files inside
public/ are copied directly to the root of the build output and cannot be imported by Astro components.
For my setup, both locations are required:
- Images referenced by content or components must live under
src/.
- Files such as PDFs must live under
public/ so they are copied to the final build output and can be downloaded.
Problem
There is currently no way to configure Sveltia CMS to properly support this setup.
The file picker always shows files from the Global Assets folder. This causes conflicts:
- If the global
media_folder is set to src/assets, users must not select files from this folder for direct downloads.
- If the global
media_folder is set to public/, image files stored there appear in Global Assets, but they cannot be imported by Astro components.
Since Global Assets are always visible, users can select files that are not valid for a specific field.
Requested Improvement
Allow Global Assets to be disabled at the field level.
This would make it possible to:
- Use
src/ for images referenced by content.
- Use
public/ for downloadable files.
- Prevent invalid files from appearing in the file picker for specific fields.
Possible Configuration Options
Two possible ideas for the configuration API:
Option 1: Disable through media_libraries config
name: my-upload
media_folder: "/public/files"
public_folder: "/files"
media_libraries:
default: false # new behaviour
Option 2: Explicit field level flag
name: my-upload
media_folder: "/public/files"
public_folder: "/files"
global_media_folder: false # new config option
Default behaviour would remain unchanged unless explicitly disabled.
Expected Result
When Global Assets are disabled for a field, the file picker should only display local assets from that field’s specific media_folder. Global Assets should not be visible or selectable for that field.
This would allow Astro users to properly separate src/ based assets from public/ based assets without breaking imports or downloads.
Context
I am using Sveltia CMS in an Astro project.
Astro supports two locations for static files:
src/can be imported by Astro components or referenced in content collections.public/are copied directly to the root of the build output and cannot be imported by Astro components.For my setup, both locations are required:
src/.public/so they are copied to the final build output and can be downloaded.Problem
There is currently no way to configure Sveltia CMS to properly support this setup.
The file picker always shows files from the Global Assets folder. This causes conflicts:
media_folderis set tosrc/assets, users must not select files from this folder for direct downloads.media_folderis set topublic/, image files stored there appear in Global Assets, but they cannot be imported by Astro components.Since Global Assets are always visible, users can select files that are not valid for a specific field.
Requested Improvement
Allow Global Assets to be disabled at the field level.
This would make it possible to:
src/for images referenced by content.public/for downloadable files.Possible Configuration Options
Two possible ideas for the configuration API:
Option 1: Disable through
media_librariesconfigOption 2: Explicit field level flag
Default behaviour would remain unchanged unless explicitly disabled.
Expected Result
When Global Assets are disabled for a field, the file picker should only display local assets from that field’s specific
media_folder. Global Assets should not be visible or selectable for that field.This would allow Astro users to properly separate
src/based assets frompublic/based assets without breaking imports or downloads.