Hello,
I have recently started work on a Hugo website that I publish on GitHub pages at https://tuttu.github.io/StellarisAssets/. This is a project GitHub site so the last part StellarisAssets
is mandatory in the URL.
I have set my baseURL
to baseURL = 'https://tuttu.github.io/StellarisAssets/'
and locally with Hugo server, everything renders fine. But when I publish on GitHub pages, all the link to my static content (CSS, JS, pictures…) are broken because they are in the form of https://tuttu.github.io/myCSS.css
rahter than https://tuttu.github.io/StellarisAssets/myCSS.css
.
With some help, I figured I could I could add {{ .Site.BaseURL }}
before the relative links to all my static content to solve the issue. However, I feel like it’s not normal and I can’t understand why the site behaves like it does once published on GitHub pages. Anyone could explain it to me?
If interested, the source are located here: https://github.com/Tuttu/StellarisAssets
The theme I’m using is custom build from scratch and and example use of {{ .Site.BaseURL }}
can be found here: https://github.com/Tuttu/StellarisAssets/blob/master/themes/StellarisTheme/layouts/partials/head.html