This commit is contained in:
Dave Gallant
2024-01-07 14:50:58 -05:00
parent bb5e1f688b
commit fdc27aad3a
8 changed files with 10 additions and 88 deletions

View File

@@ -11,9 +11,4 @@
{{ end }}
{{ end }}
{{ if $.Site.Params.tagCloud.enable }}
<aside>
{{ partial "tag-cloud.html" . }}
</aside>
{{ end }}
</div>

View File

@@ -1,20 +0,0 @@
{{ $url := .Permalink }}
{{ $title := .Title }}
{{ with $.Site.Params.socialShare }}
<div class="social-share">
<strong class="social-share__heading">Share this post: </strong>
{{ range . }}
{{ $href := .formatString }}
{{ $href := replace $href "{url}" (urlquery $url) }}
{{ $href := replace $href "{title}" (urlquery $title) }}
<a
class="social-share__item"
href="{{ $href | safeURL }}"
target="_blank"
rel="noreferrer"
>
{{ partial (printf "icons/%s" .iconSuite) .iconName }}
</a>
{{ end }}
</div>
{{ end }}

View File

@@ -1,32 +0,0 @@
<!--
Original work by Artem Sidorenko: https://www.sidorenko.io/post/2017/07/nice-tagcloud-with-hugo/
Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0/)
-->
{{ with $.Site.Taxonomies.tags }}
{{ $fontUnit := "rem" }}
{{ $minFontSize := $.Site.Params.tagCloud.minFontSizeRem | default 0.8 }}
{{ $maxFontSize := $.Site.Params.tagCloud.maxFontSizeRem | default 2.0 }}
{{ $fontSizeSpread := sub $maxFontSize $minFontSize }}
{{ $min := len (index .ByCount.Reverse 0).Pages }}
{{ $max := add (len (index .ByCount 0).Pages) 1 }}
<div class="tag-cloud">
{{ range $tagName, $weightedPages := . }}
{{ $count := len $weightedPages.Pages }}
{{ $weight := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
{{ $fontSize := (add $minFontSize (mul $fontSizeSpread $weight) ) }}
<a
href="{{ "/tags/" | relLangURL }}{{ $tagName | urlize }}"
style="font-size:{{ $fontSize }}{{ $fontUnit }}"
{{ if eq $.Page.Params.title $tagName -}}
class="tag-cloud__tag tag-cloud__tag--active"
{{ else -}}
class="tag-cloud__tag"
{{ end -}}
>{{ $tagName }}</a
>
{{ end }}
</div>
{{ end }}