Hugo Site Looks Different Served Locally vs Remotely [SOLVED]

Published: 2021 August 12

software development web development static site generator Hugo Chrome DevTools technical troubleshooting technical troubleshooting - solved

The Problem

When a new website layout generated with Hugo was pushed to production it rendered very differently on the web than it appeared locally.

It looked like the CSS was only partially applied and some elements overlapped one another.

The Process

First, the source files were compared, but, as expected, they appeared identical.

Next, DevTools in the Chrome browser was used to compare a sample element on the site running locally vs remotely and showed that the sites were being styled by different CSS rules.

Then a look at the DevTools Console output revealed an error message:

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

A web search for “This request has been blocked; the content must be served over HTTPS." returned a related StackOverflow answer that added some additional context.

A search of the Hugo project files for “http:" revealed that the project’s config.toml file had “baseURL” set to “http://loopedline.com/".

The Solution

Updating “baseURL” to “https://loopedline.com/" resolved the issue.

Copying Directory Structure With a Bash Script - With Help From ChatGPT AI

Published: 2024 January 22

Trouble Adding Accounts to Mozilla Thunderbird Email Client [SOLVED]

Published: 2023 September 02

Backing Up Git Config Values With a Bash Script

Published: 2023 August 25