Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression of relURL since 0.101.0 #10497

Closed
multun opened this issue Dec 4, 2022 · 4 comments
Closed

Regression of relURL since 0.101.0 #10497

multun opened this issue Dec 4, 2022 · 4 comments

Comments

@multun
Copy link

multun commented Dec 4, 2022

What version of Hugo are you using (hugo version)?

All versions since 0.101.0 are affected. 0.100.2 is the last known working version.
This breakage was introduced by #10002

Does this issue reproduce with the latest release?

Yes

Description

When a baseURL has a path (like so http://website.com/path/), relURL fails to take the path into account.
This leads to broken links and javascript failing to load with docsy.

Reproducer

# get the site source
git clone --recurse-submodules [email protected]:DGEXSolutions/osrd-website.git
cd osrd-website
# npm install dependencies
docker run --rm -it -v $(pwd):/src -w /src/themes/docsy --entrypoint npm klakegg/hugo:ext-alpine install
# build the website with a working revision
docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:0.100.2-ext-alpine build
grep /js/tabpane-persist.js public/fr/docs/index.html
# build the website with a failing revision
docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:0.101.0-ext-alpine build
grep /js/tabpane-persist.js public/fr/docs/index.html

This reproducers observes the result of <script src='{{ "js/tabpane-persist.js" | relURL }}'></script> with baseURL = "https://dgexsolutions.github.io/osrd-website/"

With the failing revision:

<script src='/js/tabpane-persist.js'></script>

With the working revision:

<script src='/osrd-website/js/tabpane-persist.js'></script>
@jmooring
Copy link
Member

jmooring commented Dec 4, 2022

See #10049 (comment)

The documentation is correct:
https://gohugo.io/functions/relurl/

@bep
Copy link
Member

bep commented Dec 5, 2022

This was a bug fix, not a regression.

@bep bep closed this as completed Dec 5, 2022
@multun
Copy link
Author

multun commented Dec 15, 2022

@bep The linked issue is indeed a bugfix, but I believe it mistakenly introduced a regression, see my explanation below

@jmooring there must be a misunderstanding, the linked comment and case mentioned applies when an url start with a slash, whereas mine does not: according to documentation, {{ "js/tabpane-persist.js" | relURL }} with baseURL = "https://whatever.com/osrd-website/" should result in /osrd-website/js/tabpane-persist.js

It's also not an issue in my code: it broke good old docsy (at least when some features are enabled, such as the persistent tab pane or swagger UI)

@jmooring
Copy link
Member

@multun Let's take further discussion of this to the forum (https://discourse.gohugo.io).

@gohugoio gohugoio locked as resolved and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants