ccchh-website/layouts/shortcodes/snippet.html

15 lines
450 B
HTML

{{- $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 -}}