Files
indiekit-blog/_data/cv.js
Ricardo ab31e080bb feat: update interests templates for category-based data model
Interests are now grouped by category (matching skills pattern).
Updated cv-interests.njk to iterate categories, cv.js fallback to {},
and cv.njk hasCvData check to include interests.
2026-02-25 14:56:11 +01:00

38 lines
997 B
JavaScript

/**
* CV Data — reads from indiekit-endpoint-cv plugin data file.
*
* The CV plugin writes content/.indiekit/cv.json on every save
* and on startup. Eleventy reads that file here.
*
* Falls back to empty defaults if no plugin is installed.
*/
import { readFileSync } from "node:fs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
export default function () {
try {
const cvPath = resolve(__dirname, "..", "content", ".indiekit", "cv.json");
const raw = readFileSync(cvPath, "utf8");
const data = JSON.parse(raw);
console.log("[cv] Loaded CV data from plugin");
return data;
} catch {
// No CV plugin data file — return empty defaults
return {
lastUpdated: null,
experience: [],
projects: [],
skills: {},
skillTypes: {},
languages: [],
education: [],
interests: {},
interestTypes: {},
};
}
}