Output not having correct css
jason123santa opened this issue · 2 comments
I am trying to output my website to html so I can upload to my web host. When I run hugo -t etch the css does not show up in the outputted website.
There is the correct css when I am running the live server but not when I output to html.
This is probably because the path to the stylesheet is an absolute path and you are viewing the generated public/index.html
locally where it is not in the root /
folder. If you inspect the source code of index.html
after opening it in the browser, you'll see <link rel="stylesheet" href="/css/style.min.css">
. Usually, everything in the public
directory is uploaded to a server where a web server treats that folder as the root folder, meaning /css/style.min.css
will resolve correctly, but this won't be true if viewing the page on your computer.
If you want all the paths to load correctly when viewing public/index.html
you can add relativeURLs = true
to config.toml
and it should fix the problem.
Worked just fine once I added relativeURLs = true to the config.
I did want to put it under /blog and have my main website something different so this is a big help.
Thanks for the help.