mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-14 22:48:50 +02:00
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:
@@ -9,13 +9,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { readFileSync } from "node:fs";
|
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 () {
|
export default function () {
|
||||||
try {
|
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 raw = readFileSync(configPath, "utf8");
|
||||||
const config = JSON.parse(raw);
|
const config = JSON.parse(raw);
|
||||||
console.log("[homepageConfig] Loaded plugin config");
|
console.log("[homepageConfig] Loaded plugin config");
|
||||||
|
|||||||
Reference in New Issue
Block a user