-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Global resource isn't published when using an uncommon code construct #12190
Comments
Another issue makes a conflict with https://github.com/adityatelange/hugo-PaperMod/blob/55b2eb48ff90f086c300e9e33632465e919e2794/layouts/partials/header.html#L100-L103 |
Without digging into this too much... 1) When I build the example site with v0.122.0, I see:
There are no images in the above, so this doesn't appear to be anything new. 2) Why should the images be published to the assets directory? |
|
To reproduce:
This worked in v0.122.0, and stopped working in v0.123.0 through v0.123.7. |
If it's another issue, open another issue. |
Here's the change in behavior... Content
Template (layouts/index.html)I have never seen or used this construct before; not sure if it was ever supposed to work.
You'll get the same result when replacing Expected (v0.122.0)
Actual (v0.123.7)
Test casefailing test casefunc TestFoo(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- assets/a.txt --
I am a.txt
-- assets/b.txt --
I am b.txt
-- layouts/index.html --
{{ with resources.ByType "text" }}
{{ with .Get "a.txt" }}
{{ .Publish }}
{{ end }}
{{ with .GetMatch "*b*" }}
{{ .Publish }}
{{ end }}
{{ end }}
`
b := hugolib.Test(t, files)
b.AssertFileExists("public/index.html", true)
b.AssertFileExists("public/a.txt", true) // failing test
b.AssertFileExists("public/b.txt", true) // failing test
} |
assets
directory are not processed
@jmooring I don't understand why this is being highlighted as uncommon/questionable code construct? Global resources are useful and are required when you intend to use a single image with all pages. For example processing images to watermark your images or apply some filter on all of them (read https://adityatelange.in/blog/hugo-watermarking-images/#the-code-snippet-). |
I understand that, but I have never seen the construct where the I don't have a problem with the construct; I like the parallelism:
|
Hi @jmooring, I see this isn't fixed yet. Please check build logs here https://github.com/adityatelange/hugo-PaperMod/actions/runs/8191602302/job/22401179967#step:8:24 Images are not present specifically https://adityatelange.github.io/hugo-PaperMod/images/papermod-cover.png |
@adityatelange We fixed this issue, but it looks like there's a matching problem now. See #12214. FYI, commenting on a closed issue isn't the best approach. Frequently such comments are ignored because... the issue is closed. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
Steps to reproduce
Images are linked on this page https://github.com/adityatelange/hugo-PaperMod/blob/4bdc993b98cc82d1c59efca0774f85811b0bf213/content/posts/papermod/papermod-installation.md?plain=1#L10-L12
The text was updated successfully, but these errors were encountered: