mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
feat: add configurable CV page layout with builder support
CV page now reads layout config from cv-page.json when available, supporting single-column, two-column, and full-width hero layouts with configurable sections, sidebar widgets, and footer columns. Falls back to the previous hardcoded layout when no config exists.
This commit is contained in:
29
_data/cvPageConfig.js
Normal file
29
_data/cvPageConfig.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* CV Page Configuration Data
|
||||
* Reads config from indiekit-endpoint-cv plugin CV page builder.
|
||||
* Falls back to null — cv.njk then uses the default hardcoded layout.
|
||||
*
|
||||
* The CV plugin writes a .indiekit/cv-page.json file that Eleventy watches.
|
||||
* On change, a rebuild picks up the new config, allowing layout changes
|
||||
* without a Docker rebuild.
|
||||
*/
|
||||
|
||||
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 {
|
||||
// Resolve via the content/ symlink relative to the Eleventy project
|
||||
const configPath = resolve(__dirname, "..", "content", ".indiekit", "cv-page.json");
|
||||
const raw = readFileSync(configPath, "utf8");
|
||||
const config = JSON.parse(raw);
|
||||
console.log("[cvPageConfig] Loaded CV page builder config");
|
||||
return config;
|
||||
} catch {
|
||||
// No CV page builder config — fall back to hardcoded layout in cv.njk
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user