kakawait / hugo-tranquilpeak-theme

A gorgeous responsive theme for Hugo blog framework
https://tranquilpeak.kakawait.com
GNU General Public License v3.0
926 stars 525 forks source link

Fix script url for BaseUrl with path #531

Closed moomop closed 3 years ago

moomop commented 3 years ago

The URL generated for the javascript file is broken in the case that the baseURL has a path (e.g. https://www.example.com/my_blog)

The discussion at https://discourse.gohugo.io/t/absurl-function-strips-path-when-using-baseurl-flag/5925 suggests that when there is a '/' at the start of the input to absURL, the URL generated will be relative to the server/host (which I believe isn't what we want here).

This change works for me for URLs both with and without paths.

kakawait commented 3 years ago

What do you think to do the same fix for css file?

moomop commented 3 years ago

I think the css looks ok: <link rel="stylesheet" href="{{ "css/style-h6ccsoet3mzkbb0wngshlfbaweimexgqcxj0h5hu4h82olsdzz6wmqdkajm.min.css" | absURL }}" /> (in layouts/partials/head.html).

I wouldn't have run into any issue there though as I'm using a hugo pipeline to generate the css from the scss

kakawait commented 3 years ago

You're correct. I checked too quickly haha