all repos — website-hugo @ c5fc19db0a39347ef9b35a3fe55c4d35ed41b7bf

My personal blog, built with Hugo!

layouts/_default/list.html (view raw)

 1{{ define "main" }}
 2{{ if isset .Data "Term" }}
 3<h1>Entries tagged - "{{ .Data.Term }}"</h1>
 4{{ else }}
 5<h1 class="page-title">All articles</h1>
 6{{ end }}
 7<ul class="posts">
 8	{{- range .Data.Pages -}}
 9		{{- if (not (in (.Site.Params.excludedTypes | default (slice "page")) .Type)) -}}
10		<li class="post">
11			<span class="meta">{{ dateFormat "2006-01-02" .Date }}</span>
12			<a href="{{ .RelPermalink }}">{{.Title}}</a>
13			<span class="meta">
14				{{ if .Draft }} <span class="draft-label">DRAFT</span> {{ end }}
15				{{ range (.GetTerms "tags") }}[<a href="{{ .Permalink }}" class="tag">{{ .LinkTitle }}</a>] {{ end }}
16			</span>
17		</li>
18		{{- end -}}
19	{{- end -}}
20</ul>
21
22<h2>All tags</h2>
23
24{{ $biggest := 1 }}
25{{ $smallest := 1 }}
26{{ $max := 3 }}
27{{ $min := 1 }}
28{{ $size := $min }}
29
30{{ $data := .Data }}
31<div class="tag-cloud">
32	<ul class="tags">
33		{{ range $key, $value := .Site.Taxonomies.tags.ByCount }}
34		{{ $size := (add (mul (div $value.Count $biggest) (sub $max $min)) $min) }}
35		{{ $size := (cond (eq $biggest $smallest) $min $size) }}
36		<li class="post"><a style="font-size: {{ $size }}rem;" href="{{ $.Site.LanguagePrefix | absURL }}{{ $data.Plural }}/tags/{{ $value.Name | urlize }}/">{{ $value.Name }}</a></li>
37		{{ end }}
38	</ul>
39</div>
40
41{{ end }}