2024-02-08 21:36:10

This commit is contained in:
Kai Kimera 2024-02-09 00:36:10 +03:00
parent 9ad6003b01
commit cfe4a72f4f
Signed by untrusted user: KaiKimera
GPG key ID: 2C3384BCFF16E5D4

View file

@ -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) -}}
<a href="{{ ($tag.RelPermalink) }}" target="_blank">#{{ ($text) }}</a>
{{- else if ($cat) -}}
<a href="{{ ($cat.RelPermalink) }}" target="_blank">#{{ ($text) }}</a>
{{- else -}}
{{- ($text) -}}
{{- end -}}
{{- else -}}
{{ (partial "alerts/no_params" .) }}
{{- end -}}