Skip to content

Commit

Permalink
tweak matching logic
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Oct 31, 2024
1 parent 09cf4fa commit dc91f20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions greenwood.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
}

Expand All @@ -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}`,
);
}
});
Expand Down

0 comments on commit dc91f20

Please sign in to comment.