feat: allow subpages to override title and add subtitle in gallery.yaml

This commit is contained in:
ralksta
2026-03-08 22:46:27 +01:00
parent 88f03fe2ce
commit 32bb6cb2ca
6 changed files with 57 additions and 34 deletions

View File

@@ -78,6 +78,8 @@ export function getConfig(): AppConfig {
return {
name: sp.name,
slug: slugify(sp.name),
title: sp.title,
subtitle: sp.subtitle,
albumIds: sp.albums.map((entry) => processAlbumEntry(entry, `subpage "${sp.name}"`)),
password: sp.password,
...(sp.grid ? {
@@ -95,12 +97,14 @@ export function getConfig(): AppConfig {
if (Array.isArray(value)) {
return { name, slug: slugify(name), albumIds: value.map((entry) => processAlbumEntry(entry, `subpage "${name}"`)) };
}
interface SubpageObjectValue { albums?: Array<string | Record<string, string>>; password?: string; grid?: { columns?: number; gap?: number; aspectRatio?: string; layout?: string; }; }
interface SubpageObjectValue { title?: string; subtitle?: string; albums?: Array<string | Record<string, string>>; password?: string; grid?: { columns?: number; gap?: number; aspectRatio?: string; layout?: string; }; }
const sp = value as SubpageObjectValue;
const albumEntries = sp.albums || [];
return {
name,
slug: slugify(name),
title: sp.title,
subtitle: sp.subtitle,
albumIds: albumEntries.map((entry) => processAlbumEntry(entry, `subpage "${name}"`)),
password: sp.password,
...(sp.grid ? {

View File

@@ -1,6 +1,8 @@
export interface SubpageConfig {
name: string;
slug: string;
title?: string;
subtitle?: string;
albumIds: string[];
password?: string;
grid?: Partial<GridConfig>;
@@ -79,6 +81,8 @@ export interface GalleryYaml {
| Record<string, string[] | Array<string | Record<string, string>>>
| Array<{
name: string;
title?: string;
subtitle?: string;
albums: Array<string | Record<string, string>>;
password?: string;
grid?: {