Href & src issues

I have issues with all my href and scr link path and I found nothing online :

In jekyll I used to do and it was working :

With hugo I am giving the path directly :

And I got the following error :

Refused to apply style from ‘http://localhost:1313/vendor/themes/base/snipcart.css’ because its MIME type (‘text/plain’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

The same for src script :

I got this : GET http://localhost:1313/assets/js/config.js net::ERR_ABORTED 404 (Not Found)

I think that it is due to the relative path of the url, do you have any insights ?

Thank you in avance !

Hi,

I am using
baseURL ="/" for local Development

assets/js
assets/css

 {{ $script := resources.Get "js/menu.js" | minify}}
    <script src="{{ $script.Permalink }}"></script>


{{ $style := resources.Get "css/style.css" | resources.ToCSS | resources.Fingerprint }} 
<link rel="stylesheet" href="{{ $style.Permalink }}">

Hope this helps

I solved it thanks to your post !
My architecture file :

  • assets/js/en.js
  • assets/js/config.js

{{ “” | safeHTML }}
{{ $script2 := resources.Get “js/config.js” | minify}}

{{ “” | safeHTML }}
{{ $script3 := resources.Get “js/en.js” | minify}}

Thank you ! I was struggling on hugo src since I am more a jekyll man

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.