You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 file js has no extension.
The content type of the script file is application/javascript. According to IANA registry, this type is obsoleted in favor of text/javascript.
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.
While this function call works fine with most other javascript files from other projets, it fails with algolia's one:
There are two reasons for this failure:
katex.min.js
) the algolia script filejs
has no extension.application/javascript
. According to IANA registry, this type is obsoleted in favor oftext/javascript
.Questions
I was able to work around the issue described above, but questions remain:
.js
?cdn.jsdelivr.net
? I would like to see content typetext/javascript
used here.Thanks for your attention.
The text was updated successfully, but these errors were encountered: