gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.39k stars 7.49k forks source link

resources.Get and resources.GetMatch failing when used with resources.ByType and resources.Match #12214

Closed jmooring closed 7 months ago

jmooring commented 7 months ago

Worked (sort of) in v0.123.7. Fails in v0.123.8.

Related to https://github.com/gohugoio/hugo/issues/12190, but global assets are in subdirectory.

assets/
└── snippets/
    ├── a.txt
    └── b.txt
{{ range resources.ByType "text" }}
  {{ .Name }}
{{ end }}

Expected (v0.123.7) --> /snippets/a.txt (note that in v0.122.0 this returned snippets/a.txt -- no leading slash)

Actual (v0.123.8) --> a.txt

I believe the above is causing both of these to fail (resources are not published):

{{ with resources.ByType "text" }}
  {{ with .Get "snippets/a.txt" }}
    {{ .Publish }}
  {{ end }}
{{ end }}

{{ with resources.Match "**" }}
  {{ with .GetMatch "snippets/b.txt" }}
    {{ .Publish }}
  {{ end }}
{{ end }}
github-actions[bot] commented 6 months ago

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.