HUGO

Style.css error MIME

Hi,

Based on what I understood we have to put our style in the partial folder.
So I did, I call it in my head.html file. It works for my main page http://localhost:1313/ but if click on conseil-municipal or whatever it cannot find my css or js file.

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

Thanks by advance if you can help me.
Great day

If you load http://localhost:1313/conseil-municipal/css/style.css in your browser you will probably see the 404 page. This is the “text/plain” part of the error message.

You most probably understand something wrong, because the CSS file has nothing to do in a partial folder if it is not a template. Put it in static/conseil-municipal/css/style.css in your current setup and it should work.

The problem is this CSS is on my Menu. So what I did is that :

In my head.html i have that
`






`

And all external links work everywhere. But local link doesn’t work everywhere. But I need to make it well everywhere for my menu

Can you post a link to your git repository, or even just copy and paste your head partial? I’m guessing you’re building the link to the css file incorrectly…maybe not using the absURL function, or something like that.

<head>
<meta name="viewport" content = "width = device-width, initial-scale = 1">
<link rel="stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<script type="text/javascript" src = "https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<link rel="stylesheet" href="./css/style.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script type="text/javascript"  src="./js/index.js"></script>

What is that absURL ? I’m reading the documentation but it does look weird and complicated !

I wrote on the search bar CSS and on google CSS gohugo and no tutorial or anything that can be very help like others similar technologies do. :confused:

Thank you if you can help me you that issue :slight_smile:

try this on ur head
<link href="{{ .Site.BaseURL }}css/css.css" rel="stylesheet">