From 298deddf9dab019a0fffb0c03437dea824d1f0b2 Mon Sep 17 00:00:00 2001 From: Aleix Soler Date: Fri, 21 Nov 2025 18:59:07 +0100 Subject: [PATCH] fix: write mapped statuses to every configured tag per template --- utils/frontmatterMappings.ts | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/utils/frontmatterMappings.ts b/utils/frontmatterMappings.ts index fa1e7b1..715af7f 100644 --- a/utils/frontmatterMappings.ts +++ b/utils/frontmatterMappings.ts @@ -83,28 +83,25 @@ export const resolveFrontmatterKeysForStatus = ( const scoped = toScopedStatusName(status); const mappings = settings.statusFrontmatterMappings ?? []; + const collectedKeys: string[] = []; - const statusMapping = mappings.find( - (mapping) => - mapping.scope === "status" && matchesStatusMapping(mapping, scoped), - ); - if (statusMapping) { - const keys = getMappingKeys(statusMapping); - if (keys.length) { - return keys; + mappings.forEach((mapping) => { + if (mapping.scope === "status") { + if (!matchesStatusMapping(mapping, scoped)) { + return; + } + } else if (mapping.scope === "template") { + if (!matchesStatusMapping(mapping, scoped)) { + return; + } } - } - const templateMapping = mappings.find( - (mapping) => - mapping.scope === "template" && - matchesStatusMapping(mapping, scoped), - ); - if (templateMapping) { - const keys = getMappingKeys(templateMapping); - if (keys.length) { - return keys; - } + const keys = getMappingKeys(mapping); + collectedKeys.push(...keys); + }); + + if (collectedKeys.length) { + return normalizeKeys(collectedKeys); } return [settings.tagPrefix];