You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pagefind fails when site is deployed with a non-empty baseUrl #2922
A top-level const does not create a window property. As a result, window.baseUrl is undefined, the fallback empty string is used, and Pagefind attempts to import from the domain root when the Pagefind <search /> UI is opened.
For a site with baseUrl: "/IT2900":
Actual request: /markbind/pagefind/pagefind.js (404)
Add the Pagefind component <search /> to a page or layout. Note that <searchbar> is the separate legacy heading-search component and does not exercise this code path.
Run markbind build.
Serve _site so that it is available under /example.
Open the Pagefind search UI.
Observe that the browser requests /markbind/pagefind/pagefind.js instead of /example/markbind/pagefind/pagefind.js.
Suggested fixes
Either expose the generated value explicitly:
<script>window.baseUrl='{{ baseUrl }}'</script>
or have the lazy loader consume a value that is passed without relying on a window property.
Additional evidence
The issue is present in both the v7.2.1 generated output and the current master versions of packages/core/src/Page/page.njk and packages/core-web/asset/js/pagefind-lazyloader.js.
Activity
yihao03 commentedon Sep 1, 2026
This issue is AI generated after I noticed the bug exists. I will verify and make a corresponding PR