CSS files do not load due to not being https

My css are not loading due to

Mixed Content: The page at ‘https://mysite.com/’ was loaded over HTTPS, but requested an insecure stylesheet ‘http://mysite.com/css/styles.css’. This request has been blocked; the content must be served over HTTPS.

I have baseURL = “https://mysite.com/

and looking at the header file, I have

link rel=“stylesheet” href="{{ .Site.BaseURL }}css/styles.css"

That’s odd. I can’t comment as to whether that is a bug or not but, you can just type the URL into your link rel line, or, use the path:

link rel=“stylesheet” href="/css/styles.css"

… assuming your styles is in /static/css/styles.css.

I changed {{ .Site.BaseURL }} to the URL and it is working now.

1 Like

Please try also

    <link rel="stylesheet" href="{{ relURL "css/styles.css" }}">

as relURL (or even absURL) is recommended over .Site.BaseURL nowadays.

Cheers,
Anthony

5 Likes