-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathlist.html
More file actions
45 lines (42 loc) · 1.89 KB
/
list.html
File metadata and controls
45 lines (42 loc) · 1.89 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{{ define "main" }}
<section class="content-padding flex-row">
<div class="tag-cloud is-hidden-mobile">
<h2 class="tag-cloud-title">{{ i18n "tags" }}</h2>
{{ if not (eq (len $.Site.Taxonomies.tags) 0) }}
{{ $fontUnit := "rem" }}
{{ $largestFontSize := 2.5 }}
{{ $smallestFontSize := 1.0 }}
{{ $fontSpread := sub $largestFontSize $smallestFontSize }}
{{ $max := add (len (index $.Site.Taxonomies.tags.ByCount 0).Pages) 1 }}
{{ $min := len (index $.Site.Taxonomies.tags.ByCount.Reverse 0).Pages }}
{{ $spread := sub $max $min }}
{{ $fontStep := div $fontSpread $spread }}
<ul class="tag-cloud-item">
{{ range $name, $taxonomy := $.Site.Taxonomies.tags }}
{{ $currentTagCount := len $taxonomy.Pages }}
{{ $currentFontSize := (add $smallestFontSize (mul (sub $currentTagCount $min) $fontStep) ) }}
{{ $count := len $taxonomy.Pages }}
{{ $weight := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
{{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weight) ) }}
<li>
<a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}"
style="font-size:{{$currentFontSize}}{{$fontUnit}}"
>
{{ $name }}
</a>
</li>
{{ end }}
</ul>
{{ end }}
</div>
<div class="content-container">
<!-- Here, we try to render all blog posts under a certain subdirectory -->
<!-- The exception is /posts, on which we want to render all posts -->
{{ if (eq .Page.RelPermalink "/posts/") }}
{{ partial "posts.html" (where .Site.RegularPages.ByPublishDate.Reverse "Section" .Section) }}
{{ else }}
{{ partial "posts.html" (where $.RegularPagesRecursive.ByPublishDate.Reverse "Section" .Section) }}
{{ end }}
</div>
</section>
{{ end }}