feat: added photo_archive to recognized macros for import

This commit is contained in:
2026-02-14 18:43:26 +01:00
parent 5a097283c9
commit 49e3ed7a95
2 changed files with 26 additions and 0 deletions

View File

@@ -49,6 +49,31 @@ export const macroConfigs: MacroConfig[] = [
return 'Gallery columns must be a number between 1 and 6'; return 'Gallery columns must be a number between 1 and 6';
} }
} }
// 'link' parameter is accepted for backwards compatibility but ignored
return undefined;
},
},
{
name: 'photo_archive',
description: 'Creates a photo archive gallery organized by year and month, or shows recent months',
validate: (params) => {
// Year is optional - if not provided, shows recent 10 months
if (params.year) {
const year = parseInt(params.year, 10);
if (isNaN(year) || year < 1000 || year > 9999) {
return 'Year must be a valid 4-digit year (e.g., 2024)';
}
}
// Month requires year
if (params.month) {
if (!params.year) {
return 'Month parameter requires a year parameter';
}
const month = parseInt(params.month, 10);
if (isNaN(month) || month < 1 || month > 12) {
return 'Month must be a number between 1 and 12';
}
}
return undefined; return undefined;
}, },
}, },

View File

@@ -13,6 +13,7 @@
* Parameters: * Parameters:
* - columns: Number of columns (default: 3) * - columns: Number of columns (default: 3)
* - caption: Gallery caption * - caption: Gallery caption
* - link: (deprecated, ignored) Accepted for backwards compatibility with old sites
*/ */
import { registerMacro } from '../registry'; import { registerMacro } from '../registry';