fix: resolve homepage.json via content/ symlink instead of absolute path

CONTENT_DIR env var wasn't set on Cloudron, so the data file tried
/data/content/.indiekit/homepage.json which doesn't exist. Now resolves
relative to the Eleventy project dir through the content/ symlink.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ricardo
2026-02-08 17:10:28 +01:00
parent d0360dbdf7
commit bada61e2e4

View File

@@ -9,13 +9,15 @@
*/
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const CONTENT_DIR = process.env.CONTENT_DIR || "/data/content";
const __dirname = dirname(fileURLToPath(import.meta.url));
export default function () {
try {
const configPath = resolve(CONTENT_DIR, ".indiekit", "homepage.json");
// Resolve via the content/ symlink relative to the Eleventy project
const configPath = resolve(__dirname, "..", "content", ".indiekit", "homepage.json");
const raw = readFileSync(configPath, "utf8");
const config = JSON.parse(raw);
console.log("[homepageConfig] Loaded plugin config");