Add shortcode for content snippets

This commit is contained in:
jtbx 2023-10-11 23:29:25 +02:00
parent e4ff96aee2
commit 4784466e69

View file

@ -0,0 +1,14 @@
{{- $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 -}}