diff --git a/layouts/shortcodes/snippet.html b/layouts/shortcodes/snippet.html new file mode 100644 index 0000000..0542f7a --- /dev/null +++ b/layouts/shortcodes/snippet.html @@ -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 -}}