CSS from theme stopped loading on sites with no local changes


Sometime in the last several months, my themes/CSS stopped loading when rebuilding, even for sites with no local changes. I am using the hugo-xmin theme as a module.

Deployed example

For example, this site is missing its CSS/theme. It is served from here.

Minimal example

I tried to create a site that does almost nothing but load the hugo-xmin theme as a module. I cloned jmooring’s hugo-testing and added the hugo-xmin theme as a module in the config. I pushed the example to a public GitHub repo here. And it is deployed here. The theme’s CSS is not loaded.

Under-informed speculation about the problem

That I did not change anything local led me to be concerned about recent Hugo versions above 100 and about the theme itself. I may be barking up the wrong tree, but I notice that there have been changes in both Hugo and the theme that directly relate to loading CSS, in the relevant timeframe.

hugo-xmin changes

Specifically, this commit to hugo-xmin deleted the leading / before css in:

<link rel="stylesheet" href="{{ "/css/style.css" | relURL }}" />

Hugo changes

In June there was also a Hugo commit that looks related to baseURL and relURL paths.

Local changes in my site due to Hugo run

The changes in my own, deployed site look like they might be happening at the same place, where

<link rel="stylesheet" href="/css/style.css" />

has been changed to

<link rel="stylesheet" href="/phi154/css/style.css" />

A breaking change was intentionally introduced in v0.101.0, affecting the relURL and relLangURL functions. The previous implementation of these functions was incorrect.

The xmin theme was subsequently modified to accommodate the breaking change.

You should:

  1. Update your instance of the xmin theme
  2. Build your site with v0.101.0 or later

Can you see why the minimal example — the above-referenced site created this week, after those changes to Hugo and xmin, presumably pulling down the current version of xmin, and built with 103.1 — is failing to pull in the module’s CSS?

Files in the layouts directory in the project root override the theme.