Resolve result images against an absolute baseUrl
Relative images were resolved against the page URL, but only the pathname was kept, so with a baseUrl on another domain the image still loaded from the search site. Keep the origin when the page URL has one, in the Component UI's resolveUrl filter and in both Default UI result templates. result_with_subs.svelte didn't resolve images at all before. Fixes #573
This commit is contained in:
1 parent
ed42ec389b
commit
573bb96204
6 files changed
+139
-5
No files matched your search
@@ -88,10 +88,11 @@ The template engine provides [built-in filters](https://github.com/bglw/adequate
|
||||
|
||||
#### `resolveUrl(pageUrl)`
|
||||
|
||||
Resolves a relative URL against a page URL. Absolute URLs are returned unchanged.
|
||||
Resolves a relative URL against a page URL. Absolute URLs are returned unchanged. If the page URL includes a domain, for example from a `baseUrl` on a merged index, the resolved URL keeps that domain.
|
||||
|
||||
```
|
||||
"images/hero.png" | resolveUrl("/blog/post/") → /blog/post/images/hero.png
|
||||
"images/hero.png" | resolveUrl("https://example.com/blog/post/") → https://example.com/blog/post/images/hero.png
|
||||
```
|
||||
|
||||
### Placeholder Template
|
||||
|
||||
Reference in new issue
Block a user