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
Refactors defer_pagefind to work with site.afterRender()
The previous defer_pagefind.ts exported a default function (export default function deferPagefind() { ... }) that, when called, returned another function that processes an array of pages ((pages: Page[]) => { ... }). This structure is correct for Lume's site.process() method.
However, for site.afterRender(), Lume expects a function that directly takes a single Page object as its argument. It iterates over the pages itself and passes each one to the provided function.
By changing defer_pagefind.ts to export export function deferPagefindForPage(page: Page), we are:
* Changing it to a named export: allows import as specifically as deferPagefindForPage in your _config.ts.
* Modifying its signature: directly accepts a single page: Page object, aligning with what site.afterRender() expects.
This change is fundamental to ensure the script runs at the correct stage of the Lume build process where the page.content is reliably a string (the rendered HTML), allowing the regex replacements to work as intended.
0 commit comments