Shortcodes

Updated: September 28, 2024

Hugo shortcodes.


Table of Contents

DOCUMENT DIRECTORY

<ul>
	{{ range .Resources.Match "documents/*" }}
	<li>
		<a target="_blank" href="{{ .Permalink }}">
			<i class="far fa-file-{{ .Params.icon }}"></i> {{ .Title }} <small>{{ with .Params.ref }}(Ref.{{ . }}) {{ end }}</small>
		</a>
	</li>
	{{ end }}
</ul>

Another option that works.

{{ with .Resources.ByType "page" }}
{{ range . }}
{{ if isset .Params "type" }}
{{ $path := printf "%s.html" .Type }}
{{ if templates.Exists ( printf "partials/%s" $path ) }}
{{ partial $path . }}
{{end}}
{{ end }}
{{ end }}
{{ end }}

Tab for above codeboxes.

Using Svgs in Hugo