Hi, thanks in advance for your time and help!
I have read and tested the solutions posted in various threads in related forum posts, and also combed through the documentation and release notes. NOTE: My apologies for the the lack of clickable links to some of the references below. As a “new user”, I am only allowed to add two links.
My Hugo styles are not loading after deployment to GitHub pages, but they work as expected locally:
Here is my source code repository:
The console shows 404s when trying to load the CSS files, but the deployed site seems able to load JS and images files in the same static/
directory.
The baseURL in my config.toml
file is set to:
baseURL = "https://kaizengrowth.github.io/digitalgarden/"
I’ve tried deploying this with and without the slash at the end of the baseURL in the config.toml
file. I’ve also copied the same config.toml
from the root of my directory to the theme/
folder for the Digital Garden, which I am submoduling into.
In the built index.html
file inside of the /public
folder, I see that it is trying to access the CSS files from a relative path:
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/css/all.min.css">
<link disabled id="dark-mode-theme" rel="stylesheet" href="/css/dark.css">
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link rel="stylesheet" type="text/css" href="/css/my_style.css">
As you can see, the paths in public/index.html
have not been converted to an absolute path using the baseURL in of config.toml
. In the console, I can see that it’s making calls to the wrong absolute path:
These absolute paths seem to be trying to make a request from the root of the path, and are omitting /digitalgarden
.
If I go to the correct absolute path with /digitalgarden/css/style.css
, I can see that the CSS files are displaying the expected at those links.
How do I reconfigure my site so that it is making requests to the right baseURL (absolute path with project directory)?
====
Here are my local environmental details, as specified in the “How to Request Help” article:
$ hugo env
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew
GOOS="darwin"
GOARCH="arm64"
GOVERSION="go1.22.1"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"
github.com/sass/dart-sass/protocol="2.6.0"
github.com/sass/dart-sass/compiler="1.74.1"
github.com/sass/dart-sass/implementation="1.74.1"
I am not having trouble displaying this locally, only after deployment using a standard Github pages workflow for Hugo, which you can find inside my repo.
Thank you so much for your time and help! I greatly appreciate it.