From 13278994accf31e941f755272b5662d59c3ad78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Tue, 16 Jun 2026 14:31:17 +0200 Subject: [PATCH] fix(search): use absolute bundle-path for Pagefind Component UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Pagefind modal Component UI failed to load its search bundle on shallow pages (e.g. the site homepage) with "Could not load search bundle". The bundle was requested at /pagefind/pagefind/pagefind.js (404, served as text/html) instead of /pagefind/pagefind.js. Root cause: bundle-path was page-relative ({{siteRootPath}}/pagefind/). The components load the index via a dynamic import(`${bundlePath}pagefind.js`) that runs inside /pagefind/pagefind-component-ui.js, and import() resolves relative specifiers against the importing module's URL, not the page. On shallow pages siteRootPath is ".", so "./pagefind/" resolved against .../pagefind/ and doubled to .../pagefind/pagefind/pagefind.js. Deeper pages emitted an absolute /pagefind/ and worked, masking the bug. Use an absolute, root-relative bundle-path="/pagefind/": depth-independent and matching Pagefind's documented convention (their examples use absolute paths; auto-detect also falls back to /pagefind/). Co-Authored-By: Claude Opus 4.8 Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> --- src/partials/header-content.hbs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/partials/header-content.hbs b/src/partials/header-content.hbs index 93f3b0e0..8f0996dd 100644 --- a/src/partials/header-content.hbs +++ b/src/partials/header-content.hbs @@ -6,11 +6,12 @@ {{site.title}}