Problem with `relURL` on Hugo Themes demo sites

I have a problem with my theme’s demo site on Hugo Themes.

Theme repository: Minimo

Template

I have this snippet in my theme:

<!-- Hugo Template -->
<script>window.__public_path__='{{- "assets/js/" | relURL -}}'</script> 

Rendered Result

It generates (on the Hugo Themes demo site):

<!-- Rendered HTML -->
<script>window.__public_path__='\/assets\/js\/'</script>

Expected Result

But, it was expected to render:

<!-- Expected HTML -->
<script>window.__public_path__='\/theme\/minimo\/assets\/js\/'</script>

Because, Hugo Themes demo site’s URL is https://themes.gohugo.io/theme/minimo/.
So, the relURL result should start with /theme/minimo/.

Additional Information (build result on local machine)

with (-b https://themes.gohugoio.com/theme/minimo)

git clone --depth 1 https://github.com/MunifTanjim/minimo
cd minimo
hugo --source=exampleSite --themesDir=../.. -b https://themes.gohugoio.com/theme/minimo
cat exampleSite/public/index.html | grep __public_path__

Outputs:

  </div><script>window.__public_path__='\/theme\/minimo\/assets\/js\/'</script>

with (-b https://themes.gohugoio.com)

git clone --depth 1 https://github.com/MunifTanjim/minimo
cd minimo
hugo --source=exampleSite --themesDir=../.. -b https://themes.gohugoio.com
cat exampleSite/public/index.html | grep __public_path__

Outputs:

  </div><script>window.__public_path__='\/assets\/js\/'</script>

Questions

What am I missing? I’ve been thinking about this problem for long and can’t seem figure it out.

Is there something wrong on my end?

Or is there something wrong with the Hugo Theme’s build process?

Related Issues on GitHub

Really long story:

It’s the combination of using HUGO_CANONIFYURLS=true and a BaseURL with a subdir (which is used for https://themes.gohugo.io/)
And some involved magic as hugo knows where a url is written - but not always…
See here for an example.

1 Like

So, there’s no fix for this use case! :sweat:
That’s a bummer.

Is there any active GitHub Issue about this?