mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 08:44:56 +02:00
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.
38 lines
997 B
JavaScript
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: {},
|
|
};
|
|
}
|
|
}
|