-
Notifications
You must be signed in to change notification settings - Fork 433
Open
Description
I'm successfull using docsearch on a hugo powered site.
Recently I ran into an issue: I'm retrieving algolia's script file via hugo's resources.GetRemote function.
{{ $url := "https://cdn.jsdelivr.net/npm/@docsearch/js@3" }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ end }}
{{ end }}
While this function call works fine with most other javascript files from other projets, it fails with algolia's one:
ERROR template: shortcodes/test.html:4:22: executing "shortcodes/test.html" at <resources.GetRemote>:
error calling GetRemote: failed to resolve media type for remote resource "https://cdn.jsdelivr.net/npm/@docsearch/js@3"
There are two reasons for this failure:
- Unlike the filenames of many other libraries (e.g.
katex.min.js) the algolia script filejshas no extension. - The content type of the script file is
application/javascript. According to IANA registry, this type is obsoleted in favor oftext/javascript.
curl -s -I https://cdn.jsdelivr.net/npm/@docsearch/js@3 | grep content-type:
content-type: application/javascript; charset=utf-8
Questions
I was able to work around the issue described above, but questions remain:
- Is there any way to get the algolia script file via an URL where the filename has extension
.js? - Do have any influence on the content type delivered from
cdn.jsdelivr.net? I would like to see content typetext/javascriptused here.
Thanks for your attention.
Metadata
Metadata
Assignees
Labels
No labels