mirror of
https://github.com/svemagie/obsidian-micropub.git
synced 2026-05-15 20:08:51 +02:00
feat: garden celebration update - evergreen log
This commit is contained in:
@@ -161,6 +161,13 @@ export class Publisher {
|
||||
(fm["gardenStage"] as string | undefined) ?? gardenStageFromTags;
|
||||
if (gardenStage) {
|
||||
props["gardenStage"] = [gardenStage];
|
||||
// Pass through the evergreen date so Indiekit writes it to the blog post.
|
||||
if (gardenStage === "evergreen") {
|
||||
const evergreeSince = fm["evergreen-since"] as string | undefined;
|
||||
if (evergreeSince) {
|
||||
props["evergreeSince"] = [String(evergreeSince)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,6 +384,23 @@ export class Publisher {
|
||||
}
|
||||
}
|
||||
|
||||
// Stamp evergreen-since on first promotion to the evergreen garden stage.
|
||||
{
|
||||
const { frontmatter: fm } = this.parseFrontmatter(originalContent);
|
||||
if (!fm["evergreen-since"]) {
|
||||
const rawTags = [
|
||||
...this.resolveArray(fm["tags"]),
|
||||
...this.resolveArray(fm["category"]),
|
||||
];
|
||||
const stage =
|
||||
(fm["gardenStage"] as string | undefined) ??
|
||||
this.extractGardenStage(rawTags);
|
||||
if (stage === "evergreen") {
|
||||
fields.push(["evergreen-since", publishedDate]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const fmMatch = originalContent.match(
|
||||
/^(---\r?\n[\s\S]*?\r?\n---\r?\n)([\s\S]*)$/,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user