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

github.com/xianmin/hugo-theme-jane.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/_default/terms.html')
-rw-r--r--layouts/_default/terms.html76
1 files changed, 55 insertions, 21 deletions
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
index 569ea3f..6cebc16 100644
--- a/layouts/_default/terms.html
+++ b/layouts/_default/terms.html
@@ -5,32 +5,66 @@
{{ $terms := .Data.Terms.ByCount -}}
{{ $length := len $terms -}}
{{ if eq $name "categories" }}
- <div class="categories">
- <div class="categories-title">
- {{ i18n "counter_categories" $length }}
- </div>
- <div class="categories-tags">
- {{ range $key, $value := $terms }}
- <a class="category-link" href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/">
- {{ $value.Term }}
- <span class="category-count">{{ len $value.Pages }}</span>
- </a>
- {{ end }}
- </div>
- </div>
+
+ {{ range $key, $value := $terms }}
+ <section id="archive" class="archive">
+ <div class="archive-title">
+ </div>
+ <div class="collection-title">
+ <h2 class="archive-year">
+ <a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/">
+ {{ i18n "category" }}{{ $value.Term }}
+ </a>
+ </h2>
+ </div>
+
+ {{- range first 5 $value.Pages -}}
+ <div class="archive-post">
+ <span class="archive-post-time">
+ {{ .Date.Format "2006-01-02" }}
+ </span>
+ <span class="archive-post-title">
+ <a href="{{ .URL }}" class="archive-post-link">
+ {{ .Title }}
+ </a>
+ </span>
+ </div>
+ {{- end -}}
+ {{ if gt (len $value.Pages) 5 }}
+ <div class="more-post">
+ <a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/" class="more-post-link">{{ i18n "morePost" }}</a>
+ </div>
+ {{- end -}}
+ </section>
+ {{- end -}}
+
{{ else if eq $name "tags" }}
- <div class="tag-cloud">
+ {{ if not (eq (len $.Site.Taxonomies.tags) 0) }}
+ {{ $fontUnit := "rem" }}
+ {{ $largestFontSize := 2.0 }}
+ {{ $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 }}
+ <div class="tag-cloud" style="padding: 5px 15px">
<div class="tag-cloud-title">
- {{ i18n "counter_tagcloud" $length}}
+ {{ i18n "counter_tagcloud" $length}}
</div>
<div class="tag-cloud-tags">
- {{ range $key, $value := $terms }}
- <a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/">
- {{ $value.Term }}
- <span class="tag-count">{{ len $value.Pages }}</span>
- </a>
- {{ end }}
+ {{ range $name, $taxonomy := $.Site.Taxonomies.tags }}
+ {{ $currentTagCount := len $taxonomy.Pages }}
+ {{ $currentFontSize := (add $smallestFontSize (mul (sub $currentTagCount $min) $fontStep) ) }}
+ {{ $count := len $taxonomy.Pages }}
+ {{ $weigth := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
+ {{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth) ) }}
+ <!--Current font size: {{$currentFontSize}}-->
+ <a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}" style="font-size:{{$currentFontSize}}{{$fontUnit}}">{{ $name }}</a>
+ {{ end }}
</div>
</div>
+ {{ end }}
{{ end }}
{{ end }} \ No newline at end of file