Hugo: Implicit/Indirect Assets

18 Feb 2024 18 Feb 2024 1 min read Hugo

Sometimes you have assets in your Hugo theme that are not used directly in your theme but indirectly.

In my case, I’m using npm to download/update Font Awesome. This creates the following structure in my assets folder:

Font Awesome webfont files

To tell Hugo to include all the webfont files in the generated output, use this snippet:


{{- range (resources.Match "node_modules/@fortawesome/fontawesome-free/webfonts/*") -}}
    {{- .Publish -}}
{{- end -}}