Jekyll HTTP css 未在 HTTPS 站点上加载

Jekyll HTTP css not loading on HTTPS site

我的 Jekyll 博客位于 https://wys35.github.io/

本地网站没问题,因为网站是作为 http 托管的,但是一旦网站提交(通过 Travis CI),当我访问 wys35.github.io 时,我被重定向到 https 版本该网站和 CSS(http link 的)被阻止,因为它是混合内容。

我该如何解决这个问题?

查看 DevTools 控制台:

Mixed Content: The page at 'https://wys35.github.io/' was loaded over HTTPS, but requested an insecure stylesheet 'http://wys35.github.io/css/main.css'. This request has been blocked; the content must be served over HTTPS.

此站点通过 HTTPS 提供服务,因此其所有内容都必须通过 HTTPS 提供。

将资源链接到您的文档时,无需显式设置 http:https:,仅双斜杠 // 即可,它将基于当前页面协议:

<link rel="stylesheet" href="//wys35.github.io/css/main.css">

尝试将 _config.yml 中的 url 设置为 "//wys35.github.io"