summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2024-07-13 18:57:04 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2024-07-13 18:57:04 -0400
commit6b6bd281673554ee44707293535edfad5a9919c1 (patch)
treeeb081f06fc56eed92a98e687948aea850acefda7
parentd993b951fdeea80d9b292e8a2d611a7d5e22d273 (diff)
Address updates to pagefind interface
Also a hack to address the fact that posts now use relative URLs for images <https://github.com/CloudCannon/pagefind/issues/530>
-rw-r--r--jakob/utils/pagination.scm13
-rw-r--r--pagefind.toml4
2 files changed, 14 insertions, 3 deletions
diff --git a/jakob/utils/pagination.scm b/jakob/utils/pagination.scm
index f75f02f..9e7bd47 100644
--- a/jakob/utils/pagination.scm
+++ b/jakob/utils/pagination.scm
@@ -78,7 +78,18 @@ PREVIOUS-PAGE and NEXT-PAGE."
`((link (@ (rel "stylesheet")
(href "/_pagefind/pagefind-ui.css")))
(script (@ (src "/_pagefind/pagefind-ui.js")))
- (script "window.addEventListener('DOMContentLoaded', function (event) { return new PagefindUI({ element: '#search' }); })"))
+ (script "window.addEventListener('DOMContentLoaded', function (event) {
+ return new PagefindUI({
+ element: '#search',
+ processResult: function (result) {
+ if (result.fixed) {
+ return result;
+ }
+ let path = result.raw_url;
+ let basepath = path.substring(0, path.lastIndexOf('/'));
+ result.meta.image = basepath + '/' + result.meta.image;
+ result.fixed = true;
+ return result;}});})"))
'())))
(define* (items->pages render-item items base-title base-file-name
diff --git a/pagefind.toml b/pagefind.toml
index f2cf276..9270d17 100644
--- a/pagefind.toml
+++ b/pagefind.toml
@@ -1,2 +1,2 @@
-source = "site"
-bundle_dir = "_pagefind"
+site = "site"
+output_subdir = "_pagefind"