mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +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:
@@ -616,12 +616,14 @@ export default function (eleventyConfig) {
|
||||
});
|
||||
|
||||
// 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;
|
||||
// Use directories.output (reflects --output CLI flag) instead of dir.output (config default)
|
||||
const outputDir = directories?.output || dir.output;
|
||||
// Pagefind indexing
|
||||
try {
|
||||
console.log(`[pagefind] Indexing ${dir.output} (${runMode})...`);
|
||||
execFileSync("npx", ["pagefind", "--site", dir.output, "--output-subdir", "pagefind", "--glob", "**/*.html"], {
|
||||
console.log(`[pagefind] Indexing ${outputDir} (${runMode})...`);
|
||||
execFileSync("npx", ["pagefind", "--site", outputDir, "--output-subdir", "pagefind", "--glob", "**/*.html"], {
|
||||
stdio: "inherit",
|
||||
timeout: 60000,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user