0.19 to 0.30.2 baseURL forward slash is required

I ran into this issue just now, and hope it helps someone else.

I upgraded to latest Hugo:

Preparing to unpack hugo_0.30.2_Linux-64bit.deb ...
Unpacking hugo (0.30.2) over (0.19) ...

In my build script, I have this final statement:

hugo -b="https://www.psychedelicsdaily.com"

which caused everything to become https://www.psychedelicsdaily.comimg/ etc.

hugo -b="https://www.psychedelicsdaily.com/" (note the ending forward slash)

Everything now becomes https://www.psychedelicsdaily.com/img/. Super duper!

All my templates loaded resources from {{ $baseurl }img which worked until 0.19. This seems to have been modified in the latest version, so be mindful of that, folks.

All is well in my psychedelic world. Thanks for Hugo! :slight_smile:

The recommended way to reference resources is to use either relURL or absURL template funcs, which handles the slash issues.

I see. so instead of doing {{.Site.BaseURL}}img/something.jpg, I should instead do {{ "img/something.jpg" | absURL }} ?

If so, then what would be the value of BaseURL? Would the BaseURL then contain a trailing slash?

It doesn’t matter.

1 Like