We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The RelPermalink of scss file converted using toCSS is incorrect when the baseURL has a path and canonifyURLs is enabled.
RelPermalink
toCSS
baseURL
canonifyURLs
I already found #4733 which suggests removing support of canonifyURLs. I will disable canonifyURLs in my configuration to work around this problem.
hugo version
$ hugo version hugo v0.132.1-1bde700dfc0770bb11eb8445aff1ab5abdccb46e+extended linux/amd64 BuildDate=2024-08-13T10:10:10Z VendorInfo=gohugoio
Yes, it does happen with v0.132.2.
I created a test that can reproduce the problem. This test fails when added to the hugo codebase.
func TestRelParmalink(t *testing.T) { files := ` -- hugo.toml -- canonifyURLs = true baseURL = 'https://caspermeijn.github.io/receptenboek/' -- assets/scss/main.scss -- h2 { color: blue; } -- layouts/index.html -- {{ $cssOpts := (dict "targetPath" "css/gochowdown.css" ) }} {{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }} <link rel="stylesheet" href="{{ $r.RelPermalink }}"> ` b := hugolib.NewIntegrationTestBuilder( hugolib.IntegrationTestConfig{ T: t, TxtarString: files, NeedsOsFS: true, }).Build() b.AssertFileContent("public/index.html", "<link rel=\"stylesheet\" href=\"https://caspermeijn.github.io/receptenboek/css/gochowdown.css\">") }
The text was updated successfully, but these errors were encountered:
In the example above...
Expected URL to stylesheet:
https://caspermeijn.github.io/receptenboek/css/gochowdown.css
Actual URL to stylesheet:
https://caspermeijn.github.io/receptenboek/receptenboek/css/gochowdown.css
Instead of fixing this, can we instead deprecate canonifyURLs per #4733? In the documentation we've been discouraging its use for a quite a while: https://gohugo.io/content-management/urls/#canonical-urls
Sorry, something went wrong.
Seems a valid solution to me. I was using canonifyURLs because it came with the example inside a theme. I didn't know it was discouraged.
No branches or pull requests
The
RelPermalink
of scss file converted usingtoCSS
is incorrect when thebaseURL
has a path andcanonifyURLs
is enabled.I already found #4733 which suggests removing support of
canonifyURLs
. I will disablecanonifyURLs
in my configuration to work around this problem.What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes, it does happen with v0.132.2.
Reproducable
I created a test that can reproduce the problem. This test fails when added to the hugo codebase.
The text was updated successfully, but these errors were encountered: