Asset Placement
Astro supports two useful strategies:
- Processed source assets live under
src/(or beside content) and are imported into MDX. Astro fingerprints them, reads metadata, and can optimize supported raster images. The diagram on the image page lives insrc/assets/diagram.svg. - Public assets live under
public/and are copied unchanged. This sample’spublic/assets/starlight-demo.svgis available at the configured site base and is appropriate when a stable filename matters.
With a GitHub Pages base path, avoid bare host-root URLs such as
/assets/file.svg. Use an imported asset, a relative URL, or prepend Astro’s
BASE_URL so development and deployment resolve the same file.
See the live Image Optimization example.