feat: add evergreen to GardenStage type and labels

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-03-15 08:45:48 +01:00
parent 6abd6ce4ba
commit fa53528137
2 changed files with 25 additions and 11 deletions
+23 -11
View File
@@ -139,7 +139,7 @@ export class Publisher {
// Categories from frontmatter `category` or `tags` (excluding garden/* tags) // Categories from frontmatter `category` or `tags` (excluding garden/* tags)
const rawTags = this.resolveArray(fm["tags"] ?? fm["category"]); const rawTags = this.resolveArray(fm["tags"] ?? fm["category"]);
const gardenStage = this.extractGardenStage(rawTags); const gardenStageFromTags = this.extractGardenStage(rawTags);
const normalTags = rawTags.filter( const normalTags = rawTags.filter(
(t) => !t.startsWith(GARDEN_TAG_PREFIX) && t !== "garden", (t) => !t.startsWith(GARDEN_TAG_PREFIX) && t !== "garden",
); );
@@ -147,9 +147,16 @@ export class Publisher {
props["category"] = normalTags; props["category"] = normalTags;
} }
// Garden stage → dedicated property // Garden stage — prefer explicit `gardenStage` frontmatter property,
if (this.settings.mapGardenTags && gardenStage) { // fall back to extracting from #garden/* tags.
props["garden-stage"] = [gardenStage]; // Send as camelCase `gardenStage` so Indiekit writes it directly to
// frontmatter without needing a preset property mapping for `garden-stage`.
if (this.settings.mapGardenTags) {
const gardenStage =
(fm["gardenStage"] as string | undefined) ?? gardenStageFromTags;
if (gardenStage) {
props["gardenStage"] = [gardenStage];
}
} }
// Syndication targets // Syndication targets
@@ -173,15 +180,20 @@ export class Publisher {
// AI disclosure — flatten nested `ai` object into individual top-level // AI disclosure — flatten nested `ai` object into individual top-level
// properties so Indiekit writes them as plain scalar frontmatter keys. // properties so Indiekit writes them as plain scalar frontmatter keys.
// Also support top-level `aiTextLevel`, `aiTools`, etc. set directly.
// Sending `ai: [{textLevel: "1"}]` makes Indiekit write a YAML array, // Sending `ai: [{textLevel: "1"}]` makes Indiekit write a YAML array,
// but the template reads `aiTextLevel` / `aiCodeLevel` as top-level scalars. // but the template reads `aiTextLevel` / `aiCodeLevel` as top-level scalars.
if (fm["ai"] && typeof fm["ai"] === "object") { const aiObj = (fm["ai"] && typeof fm["ai"] === "object")
const ai = fm["ai"] as Record<string, unknown>; ? fm["ai"] as Record<string, unknown>
if (ai["textLevel"] != null) props["aiTextLevel"] = [String(ai["textLevel"])]; : {};
if (ai["codeLevel"] != null) props["aiCodeLevel"] = [String(ai["codeLevel"])]; const aiTextLevel = fm["aiTextLevel"] ?? aiObj["textLevel"];
if (ai["aiTools"] != null) props["aiTools"] = [String(ai["aiTools"])]; const aiCodeLevel = fm["aiCodeLevel"] ?? aiObj["codeLevel"];
if (ai["aiDescription"] != null) props["aiDescription"] = [String(ai["aiDescription"])]; const aiTools = fm["aiTools"] ?? aiObj["aiTools"] ?? aiObj["tools"];
} const aiDescription = fm["aiDescription"] ?? aiObj["aiDescription"] ?? aiObj["description"];
if (aiTextLevel != null) props["aiTextLevel"] = [String(aiTextLevel)];
if (aiCodeLevel != null) props["aiCodeLevel"] = [String(aiCodeLevel)];
if (aiTools != null) props["aiTools"] = [String(aiTools)];
if (aiDescription != null) props["aiDescription"] = [String(aiDescription)];
// Photos: prefer structured photo array from frontmatter (with alt text), // Photos: prefer structured photo array from frontmatter (with alt text),
// fall back to uploaded local images. // fall back to uploaded local images.
+2
View File
@@ -105,6 +105,7 @@ export interface MicropubConfig {
export type GardenStage = export type GardenStage =
| "plant" | "plant"
| "cultivate" | "cultivate"
| "evergreen"
| "question" | "question"
| "repot" | "repot"
| "revitalize" | "revitalize"
@@ -113,6 +114,7 @@ export type GardenStage =
export const GARDEN_STAGE_LABELS: Record<GardenStage, string> = { export const GARDEN_STAGE_LABELS: Record<GardenStage, string> = {
plant: "🌱 Seedling", plant: "🌱 Seedling",
cultivate: "🌿 Growing", cultivate: "🌿 Growing",
evergreen: "🌳 Evergreen",
question: "❓ Open Question", question: "❓ Open Question",
repot: "🪴 Repotting", repot: "🪴 Repotting",
revitalize: "✨ Revitalizing", revitalize: "✨ Revitalizing",