-
Notifications
You must be signed in to change notification settings - Fork 164
Description
When Pagefind extracts the src=… value from an <img> tag for use as the thumbnail image in the search results list, it is shown as a broken (i.e., missing) image if the src=… value in the indexed page was a relative URL.
For example, consider a website with a Pagefind search form located at /search and an indexed page located at /blog/about.html. At the top of the /blog/about.html page is an image tag like this:
<img src="images/header.png" …>
When that page appears in the search results on the /search page, Pagefind will show a thumbnail img tag with src="images/header.png". That image will appear broken on the search results page, since the search page is located at /search and the indexed page was located at /blog/about.html. The images/header.png image source is relative to the index page's location in /about and not the search page's location of /search.
Pagefind should convert relative image source URLs into absolute image source URLs by prefixing them with the location of the indexed page. In this case, it should prepend /about/ to the image source images/header.png to form /about/images/header.png, then use that as the image source for the thumbnail on the search results page.