Mixed Content Error - Publishing to GitHub pages

I am building a GitHub pages site with a custom domain, and I have set the baseURL value in both a hugo.toml file and as a second attempt, in a config.toml just in case. Neither has fixed this error where the page is trying to load the theme/JS files from http and I see this in the dev tools console:

Mixed Content: The page at 'https://www.will-code-for-pay.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://www.will-code-for-pay.com/theme.min.4a7adaae74bbfed8a1bc02779a28cb26bed20f704048301344690c44af008313.css'. This request has been blocked; the content must be served over HTTPS.

GitHub Pages Site

Live Site

The theme is the Bilberry v4. I have looked at other solutions on this forum but so far, no luck.

Generating your site locally works perfectly - so the issue must be somewhere else :wink:

first: you committed both config files. remove config.toml

I would say your Guthub Pages url for your repository is set badly. Check it in your “Repository Settings” → “Github Pages”

guess there it’s written with http: - If not unpublishing and republishing your site might help.


Checking your workflow run the hugo build step:

Expand “Build Hugo” and “run hugo” you see

Run hugo \
  hugo \
    --gc \
    --minify \
    --baseURL "http://www.will-code-for-pay.com/"

This is taken from your workflow at

run: |
          hugo \
            --gc \
            --minify \
            --baseURL "${{ steps.pages.outputs.base_url }}/"

The workflow will not take it from the baseURL config setting but the GitHub Pages setting - which is normal

When in doubt, unplug it, wait a minute, and plug it back in! :grinning: Unpublishing it and rerunning the workflow did the trick, I didn’t check the “Enforce HTTPS” option until after the first time it was published, somehow that value didn’t get changed with subsequent runs. Thanks for your help.

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