Hugo Terminal sets up all pages with a relative css path from root instead of where the page is located

I deploy my site using sudo $(which hugo) -D
In my config.toml I have publishdir = '/var/www/html/'

My /var/www/html/ looks like:

├── 404.html
├── assets
│   ├── 2078a57b79d547bf1e2502f8d249b867.woff
│   ├── 58cebbe9a6bdcba6d4bb56a22a9e812f.woff
│   ├── blue.css
│   ├── green.css
│   ├── languageSelector.js
│   ├── main.js
│   ├── pink.css
│   ├── prism.js
│   ├── red.css
│   └── style.css
├── categories
│   ├── index.html
│   └── index.xml
├── favicon.ico
├── icon
│   └── favicon.ico
├── img
│   └── favicon
├── index.html
├── index.xml
├── page
│   └── 1
├── posts
│   ├── first
│   ├── index.html
│   ├── index.xml
│   └── page
├── sitemap.xml
└── tags
    ├── index.html
    └── index.xml

My main site here. looks fine, but if you press the first post you get greeted by a no css page. Upon close inspection one can see that css path in every page is "assets/some.css" when it should be something like "../../assets/some.css". Any helpful suggestions on a solution?

Post a link to your repo so we can see the theme setup and help you out.

Here is the Terminal theme I’ve added by git add submodule:

Here is my config.toml:

title = "Arkid's Place"
theme = 'terminal'
publishdir = '/var/www/html/'
paginate = 5

contentTypeName = "posts"
themeColor = "blue"
showMenyItems = 2
fullWidthTheme = false
centerTheme = false
autoCover = false
favicon = "icon/favicon.ico"
showLastUpdated = true
readingTime = true
Toc = true
# TocTitle = "Table of Contents"```

Sorry, but I haven't and won't put my site in a repo, but I assume this is enough relevant data to make helping easier.

This is the line that generates the HTML for the CSS file. It uses the absURL function which generates a URL based on the baseURL variable, set in config.toml.

You don’t have baseURL set in your config file.

Thank you, that sounds like my problem exactly. I didn’t want to put a baseUrl as I have 3 domains pointing to my site, but I assume that putting only one of them allows the page to pull the appropriate stylesheet which solves my issue.

So I went ahead and put one of my domains as the baseUrl and my problem was fixed.

@Arkid - If you have multiple deploys of the same code base, you can configure the base URL per deploy:

Via CLI with the -b option

Or via env var with HUGO_BASEURL

1 Like

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