From 8e3fb4038a026947d43ce0683b19dccf13e9c96b Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Fri, 13 May 2022 11:33:55 -0500 Subject: [PATCH] Small shortcode cleanuo & use .IsNamedParams --- layouts/_default/single.html | 2 +- layouts/_default/summary/post.html | 2 +- layouts/_default/summary/series_post.html | 2 +- layouts/shortcodes/abbr.html | 6 +++++- layouts/shortcodes/figure.html | 7 ++++++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 9874658..e6365f1 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -24,7 +24,7 @@ {{ with .Resources.GetMatch "feature" }}
- {{ partial "figure.html" (dict "src" . "border" true) }} + {{ partial "figure.html" (dict "src" .) }}
{{ end }} diff --git a/layouts/_default/summary/post.html b/layouts/_default/summary/post.html index 89b18fb..ccc682c 100644 --- a/layouts/_default/summary/post.html +++ b/layouts/_default/summary/post.html @@ -9,7 +9,7 @@ {{ with .Resources.GetMatch "feature" }}
- {{ partial "figure.html" (dict "src" . "border" true) }} + {{ partial "figure.html" (dict "src" .) }}
{{ end }} diff --git a/layouts/_default/summary/series_post.html b/layouts/_default/summary/series_post.html index 8ce485a..64c2aeb 100644 --- a/layouts/_default/summary/series_post.html +++ b/layouts/_default/summary/series_post.html @@ -15,7 +15,7 @@ {{ with .Resources.GetMatch "feature" }}
- {{ partial "figure.html" (dict "src" . "border" true) }} + {{ partial "figure.html" (dict "src" .) }}
{{ end }} diff --git a/layouts/shortcodes/abbr.html b/layouts/shortcodes/abbr.html index 0813f2e..f557c06 100644 --- a/layouts/shortcodes/abbr.html +++ b/layouts/shortcodes/abbr.html @@ -1 +1,5 @@ -{{ .Inner }} +{{ if .IsNamedParams }} + {{ .Inner }} +{{ else }} + {{ .Inner }} +{{ end }} diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 7a272ac..9d91d45 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,4 +1,9 @@ -{{ $resource := $.Page.Resources.GetMatch (.Get "src") }} +{{ $resource := "" }} +{{ if .IsNamedParams }} + {{ $resource = $.Page.Resources.GetMatch (.Get "src") }} +{{ else }} + {{ $resource = $.Page.Resources.GetMatch (.Get 0) }} +{{ end }} {{ $noborder := false }} {{ if .Get "noborder" }}