Skip to content

Commit

Permalink
fix [templates]: resolves #160
Browse files Browse the repository at this point in the history
  • Loading branch information
MunifTanjim committed Aug 5, 2018
1 parent ed8bb03 commit bfae07c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
12 changes: 5 additions & 7 deletions layouts/partials/entry/taxonomy-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
</span>
<span class='screen-reader-text'>{{ ( ( i18n $tx 2 ) | default $txs ) | title }}: </span>
{{- range $i, $term := ( index $.Params $txs ) -}}
{{- if gt $i 0 }}, {{ end -}}
<a class='{{ $tx }}' href='{{ ( print $txs "/" ( $term | urlize ) ) | relLangURL }}'>
{{- with $.Site.GetPage ( print "/" $txs "/" ( $term | urlize ) ) -}}
{{- .Title -}}
{{- else -}}
{{- $term -}}
{{- with $.Site.GetPage ( print "/" $txs "/" $term ) -}}
{{- if gt $i 0 }}, {{ end -}}
<a class='{{ $tx }}' href='{{ .RelPermalink }}'>
{{- .Title -}}
</a>
{{- end -}}
</a>
{{- end -}}
</div>
17 changes: 8 additions & 9 deletions layouts/partials/extras/taxonomy_cloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{{- $Site := $Scope.Site -}}
{{- $Scratch := $Scope.Scratch -}}
{{- $Shuffle := ( .Shuffle | default true ) -}}
{{- $Taxonomy := .Taxonomy -}}
{{- $Data := ( $Site.GetPage $Taxonomy ).Data -}}
{{- $TaxonomyPage := ( $Site.GetPage ( print "/" .Taxonomy ) ) -}}
{{- $Data := $TaxonomyPage.Data -}}

<div class='container list-container'>
<ul class='list taxonomy-cloud {{- if not $Shuffle }} no-shuffle{{- end -}}'>
<ul class='list taxonomy-cloud {{- if not $Shuffle }} no-shuffle {{- end -}}'>
{{- if gt ( len $Data.Terms ) 0 -}}
{{- $maxSize := 2.0 -}}
{{- $minSize := 1.0 -}}
Expand All @@ -16,24 +16,23 @@
{{- $minCount := ( index $Data.Terms.ByCount.Reverse 0 ).Count -}}
{{- $countSpread := ( sub $maxCount $minCount ) -}}


{{- $Scratch.Set "sizeStep" 0 -}}
{{- if gt $countSpread 0 -}}
{{- $Scratch.Set "sizeStep" ( div $sizeSpread $countSpread ) -}}
{{- end -}}


{{- range $Data.Terms.Alphabetical -}}
{{- $count := .Count -}}
{{- $sizeStep := ( $Scratch.Get "sizeStep" ) -}}
{{- $size := ( add $minSize ( mul $sizeStep ( sub $count $minCount ) ) ) -}}

{{- with $Site.GetPage ( print "/" $Data.Plural "/" .Term ) -}}
<li>
<a href='{{ ( print $Data.Plural "/" ( .Term | urlize ) ) | relLangURL }}' style='font-size:{{ $size }}em'>
{{- with $Site.GetPage ( print "/" $Data.Plural "/" .Term ) -}}
{{- .Title -}}
{{- end -}}
<a href='{{ .RelPermalink }}' style='font-size:{{ $size }}em'>
{{- .Title -}}
</a>
</li>
{{- end -}}
{{- end -}}
{{- else -}}
<span>
Expand Down

0 comments on commit bfae07c

Please sign in to comment.