Skip to content

Hugo Page Bundles and images with no path #529

Answered by bglw
kenmorse asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @kenmorse 👋

Ah, yes Pagefind hasn't considered relative URLs before, but this case is something that should definitely be handled. Off the top of my head, I don't know whether the indexing step should resolve these, or if it's a job for the UI — my gut says UI, though, since image URLs are technically just generic "metadata".

I'll create an issue for the UI frontends to resolve relative URLs to images automatically, but in the meantime here's a fix for the Default UI (if that's what you're using):

new PagefindUI({
    element: "#search",
    showSubResults: true,
    showImages: true,
    processResult: function (result) {
        if (result?.meta?.image) {
            let resultBase = 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kenmorse
Comment options

@kenmorse
Comment options

Answer selected by kenmorse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants