From 5c7f56aeb9739dd442fc8ea46378bfc56db27683 Mon Sep 17 00:00:00 2001 From: tree Date: Fri, 2 Feb 2024 05:28:04 +0100 Subject: [PATCH] add ids to people --- schema/index.yaml | 3 +++ .../_images/{mykola.png => mykola-siusko.png} | Bin utils/engine.js | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) rename src/people/_images/{mykola.png => mykola-siusko.png} (100%) diff --git a/schema/index.yaml b/schema/index.yaml index 1543981..2dcb917 100644 --- a/schema/index.yaml +++ b/schema/index.yaml @@ -81,6 +81,9 @@ $defs: required: - name properties: + id: + type: string + pattern: "^[a-z0-9-]+$" name: type: string caption: diff --git a/src/people/_images/mykola.png b/src/people/_images/mykola-siusko.png similarity index 100% rename from src/people/_images/mykola.png rename to src/people/_images/mykola-siusko.png diff --git a/utils/engine.js b/utils/engine.js index 5f43fef..1d5432a 100644 --- a/utils/engine.js +++ b/utils/engine.js @@ -55,7 +55,10 @@ export class Engine { arr.push(obj); } if (ext === "yaml" && fn !== "index") { - const item = await readYamlFile(join(dir, dirEntry.name)); + const item = Object.assign( + { id: fn }, + await readYamlFile(join(dir, dirEntry.name)), + ); if (opts.loader === "person") { // load image const img = images.find((i) => i.id === fn);