mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
Add thin-wrapper templates for work/personal filtering of CV sections:
- 8 new templates: cv-{experience,education,skills,interests}-{personal,work}.njk
- cv-languages.njk: standalone languages section (split from education)
- homepage-section.njk: 9 new routes for filtered variants
- cv.njk: uses work-only variants for the /cv/ page
- Base templates: filterType support in experience, education, skills, interests
- _data/cv.js: skillTypes and interestTypes fallback fields
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: {},
|
|
};
|
|
}
|
|
}
|