When you use Astro's built-in image optimization, it puts the generated images in the folder dist/_astro
.
For the CSS/JS optimization, there is a setting that lets you change the folder:
export const SITE: Site = {
...
build: {
assets: 'custom-name'
},
I can't find any way to make images move from dist/_astro
.
My use-case is that I have a domain with multiple Astro microsites, each served from a folder. Therefore I want the images to be placed a level deeper in the hierarchy, for example dist/blog/_astro
.
I have also tried adding a base
setting, which is to help you run a site in a subfolder, but this also doesn't move the images.
There are two config files in Astro.
The file src/config.ts
has the SITE
configuration.
The file astro.config.mjs
is the Astro main configuration.
The setting belongs in the Astro main configuration, not the site configuration.
export default defineConfig({
...
build: {
assets: 'custom-name'
},