diff --git a/layouts/shortcodes/svg.html b/layouts/shortcodes/svg.html new file mode 100644 index 0000000..5dee9f9 --- /dev/null +++ b/layouts/shortcodes/svg.html @@ -0,0 +1,40 @@ +{{ $alt := .Get "alt" -}} +{{ $caption := .Get "caption" -}} +{{ $class := .Get "class" -}} +{{ $height := .Get "height" -}} +{{ $inline := .Get "inline" | default false -}} +{{ $link := .Get "link" -}} +{{ $src := .Get "src" -}} +{{ $width := .Get "width" -}} +{{ if and $src (fileExists (add "/assets" $src)) -}} + {{ $original := resources.Get $src -}} + {{ if $inline -}} + {{ $src = $original.Content -}} + {{ else -}} + {{ $src = $original.RelPermalink -}} + {{ end -}} +{{ else if and $src $inline (fileExists (add "/static" $src)) -}} + {{ $src = readFile (add "/static" $src) -}} +{{ end -}} +{{ if and $width $height -}} + {{ $width = int $width -}} + {{ $height = int $height -}} +{{ else if $width -}} + {{ $width = int $width -}} +{{ else if $height -}} + {{ $height = int $height -}} +{{ end -}} +{{ if $caption }}
{{ end -}} +{{ with $link }}{{ end -}} +{{ if $inline -}} +
{{ $src | safeHTML }}
+{{ else -}} +{{ . }} +{{ end -}} +{{- if $link }}
{{ end }} +{{ if $caption -}} +
+{{ $caption | markdownify -}} +
+
+{{ end -}}