From dc91f20c03ea68c8d4ce30639e77b97261aa7fd7 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Thu, 31 Oct 2024 12:47:44 -0400 Subject: [PATCH] tweak matching logic --- greenwood.config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/greenwood.config.js b/greenwood.config.js index 1ac1a1d7..00a865c7 100644 --- a/greenwood.config.js +++ b/greenwood.config.js @@ -9,7 +9,7 @@ class ActiveFrontmatterDocsTitleRestorerResource extends ResourceInterface { super(); this.extensions = ["html"]; this.contentType = "text/html"; - this.matches = ["My Blog - null", "My Site - null"]; + this.matches = ["My Blog - Active Frontmatter", "My Site - Going Further"]; this.replacer = "${globalThis.page.title}"; } @@ -22,9 +22,11 @@ class ActiveFrontmatterDocsTitleRestorerResource extends ResourceInterface { this.matches.forEach((match) => { if (body.indexOf(match) > 0) { + const titleParts = match.split("-"); + body = body.replace( new RegExp(String.raw`${match}`, "g"), - match.replace("null", this.replacer), + `${titleParts[0]}- ${this.replacer}`, ); } });