mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-15 06:58:50 +02:00
fix: use directories.output for pagefind indexing
The eleventy.after hook's dir.output reflects the config default (_site), not the --output CLI flag used by start.sh. Use directories.output which reflects the actual resolved output path.
This commit is contained in:
+5
-3
@@ -616,12 +616,14 @@ export default function (eleventyConfig) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Pagefind indexing + WebSub hub notification after each build (skip on incremental rebuilds)
|
// Pagefind indexing + WebSub hub notification after each build (skip on incremental rebuilds)
|
||||||
eleventyConfig.on("eleventy.after", async ({ dir, runMode, incremental }) => {
|
eleventyConfig.on("eleventy.after", async ({ dir, directories, runMode, incremental }) => {
|
||||||
if (incremental) return;
|
if (incremental) return;
|
||||||
|
// Use directories.output (reflects --output CLI flag) instead of dir.output (config default)
|
||||||
|
const outputDir = directories?.output || dir.output;
|
||||||
// Pagefind indexing
|
// Pagefind indexing
|
||||||
try {
|
try {
|
||||||
console.log(`[pagefind] Indexing ${dir.output} (${runMode})...`);
|
console.log(`[pagefind] Indexing ${outputDir} (${runMode})...`);
|
||||||
execFileSync("npx", ["pagefind", "--site", dir.output, "--output-subdir", "pagefind", "--glob", "**/*.html"], {
|
execFileSync("npx", ["pagefind", "--site", outputDir, "--output-subdir", "pagefind", "--glob", "**/*.html"], {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user