Small shortcode cleanuo & use .IsNamedParams

This commit is contained in:
BBaoVanC 2022-05-13 11:33:55 -05:00
parent e9266cdead
commit 8e3fb4038a
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
5 changed files with 14 additions and 5 deletions

View File

@ -24,7 +24,7 @@
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
{{ partial "figure.html" (dict "src" .) }}
</div>
{{ end }}

View File

@ -9,7 +9,7 @@
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
{{ partial "figure.html" (dict "src" .) }}
</div>
{{ end }}

View File

@ -15,7 +15,7 @@
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
{{ partial "figure.html" (dict "src" .) }}
</div>
{{ end }}

View File

@ -1 +1,5 @@
{{ if .IsNamedParams }}
<abbr title="{{ .Get "title" }}">{{ .Inner }}</abbr>
{{ else }}
<abbr title="{{ .Get 0 }}">{{ .Inner }}</abbr>
{{ end }}

View File

@ -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" }}