diff --git a/layouts/shortcodes/tag.html b/layouts/shortcodes/tag.html new file mode 100644 index 0000000..bcf818e --- /dev/null +++ b/layouts/shortcodes/tag.html @@ -0,0 +1,29 @@ +{{- /* +@param {string} (positional parameter 0) Tag name. + +@returns {template.HTML} + +@examples + + {{< tag "linux" >}} +*/ -}} + +{{- if (.Get 0) -}} + + {{- $text := (.Get 0) -}} + {{- $tag := (site.GetPage (printf "tags/%s" ($text))) -}} + {{- $cat := (site.GetPage (printf "categories/%s" ($text))) -}} + + {{- if ($tag) -}} + #{{ ($text) }} + {{- else if ($cat) -}} + #{{ ($text) }} + {{- else -}} + {{- ($text) -}} + {{- end -}} + +{{- else -}} + + {{ (partial "alerts/no_params" .) }} + +{{- end -}}