ccchh-website/layouts/shortcodes/snippet.html

15 lines
450 B
HTML
Raw Normal View History

2023-10-11 23:29:25 +02:00
{{- $asset := "" }}
{{- with (.Get 0) }}
{{- $asset = . }}
{{- else }}
{{- errorf "The %q shortcode requires a single positional parameter; the relative path to a file in the assets directory. See %s" .Name .Position}}
{{- end }}
{{- $r := "" }}
{{- with resources.Get $asset }}
{{- $r = . }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" .Name $asset .Position}}
{{- end }}
{{- $r.Content | .Page.RenderString -}}