diff --git a/common/src/gallery.ts b/common/src/gallery.ts index aee1950..c8f9f71 100644 --- a/common/src/gallery.ts +++ b/common/src/gallery.ts @@ -83,6 +83,7 @@ export const GalleryDataSchema = z.object({ metadata: GalleryMetadataSchema, mediaBaseUrl: z.string().optional(), thumbsBaseUrl: z.string().optional(), + assetsBaseUrl: z.string().optional(), analyticsScript: z.string().optional(), ctaBanner: z.boolean().optional(), sections: z.array(GallerySectionSchema), diff --git a/docs/configuration.md b/docs/configuration.md index 7092e40..f4d3a34 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -236,6 +236,46 @@ Markdown formatting is available in: Thumbnails will automatically be generated using sizes that fit the theme (300px height and 600px height for retina displays). If you want, you can change the size using the `thumbnailSize` attribute in the `gallery.json` file. +## Static assets (CSS and JavaScript) + +By default, each gallery includes its own copy of the static asset files (CSS and JavaScript) in the `gallery/assets/` folder. However, if you're hosting multiple galleries built with the same version of Simple Photo Gallery, you can share these assets between all galleries to reduce storage and improve caching. + +Use the `assetsBaseUrl` option to specify the base URL where the shared static assets are hosted: + +```json +{ + "title": "My Gallery", + "description": "...", + "assetsBaseUrl": "https://cdn.example.com/simple-photo-gallery/v1.0.0" +} +``` + +When set, the generated HTML will load CSS and JavaScript files from the specified URL instead of the local `gallery/assets/` folder: + +```html + +