Welcome to mirror list, hosted at ThFree Co, Russian Federation.

litt.html « shortcodes « layouts - github.com/it-gro/hugo-theme-w3css-basic.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08d481d928af8a4fab1e4a8a4ce408a45218c867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{{/* https://github.com/it-gro/hugo-theme-w3css-basic */}}
{{- $.Scratch.Set `theTaxonomy`  `tags`   }}
{{- $.Scratch.Set `theTaxTerm`   `*`      }}
{{- $.Scratch.Set `theOutFormat` `.Title` }}
{{- if .IsNamedParams }}
  {{- $.Scratch.Set `theTaxonomy`     (.Get `tax`       | default ($.Scratch.Get `theTaxonomy`  ) )}}
  {{- $.Scratch.Set `theTaxTerm`      (.Get `term`      | default ($.Scratch.Get `theTaxTerm`   ) )}}
  {{- $.Scratch.Set `theOutFormat`    (.Get `ofm`       | default ($.Scratch.Get `theOutFormat` ) )}}
{{- else }}
  {{- $myPos := 0}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set `theTaxonomy`   (.Get $myPos) }} {{end}}
  {{- $myPos := 1}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set `theTaxTerm`    (.Get $myPos) }} {{end}}
  {{- $myPos := 2}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set `theOutFormat`  (.Get $myPos) }} {{end}}
{{- end }}

{{- if or $.Site.Params.debug (findRE `\bdebug-shortcode(s|-litt)\b` $.Site.Params.traceFlags) }}
<br/>
`theTaxonomy`  : {{- $.Scratch.Get `theTaxonomy`    }} <br/>
`theTaxTerm`   : {{- $.Scratch.Get `theTaxTerm`     }} <br/>
`theOutFormat` : {{- $.Scratch.Get `theOutFormat`   }} <br/>
{{- end }}

{{- with $.Site.GetPage `taxonomy` ($.Scratch.Get `theTaxonomy`) (lower ($.Scratch.Get `theTaxTerm`)) }}
  <a href='{{.URL}}'>
    {{- if findRE `.Kind`         ($.Scratch.Get `theOutFormat`)}}{{.Kind -}}:&nbsp;{{end}}
    {{- if findRE `.RelPermalink` ($.Scratch.Get `theOutFormat`)}}{{.RelPermalink}}{{end}}
    {{- if findRE `.Title`        ($.Scratch.Get `theOutFormat`)}}{{.Title | markdownify | emojify }} {{end}}
  </a>&nbsp;
{{- end }}