bunteshaus.de/themes/buha/layouts/partials/sidebar.html
2021-10-23 22:23:48 +02:00

95 lines
3.8 KiB
HTML

{{ $s := .Site.Params }}
<section class="sidebar_inner">
{{- if $s.IntroDescription }}
{{- $author := $s.Author }}
{{- $showAuthorPhoto := false }}
{{- $fullAuthor := reflect.IsMap $author }}
{{- if $fullAuthor }}
{{- if $author.photo }}
{{- $showAuthorPhoto = true }}
{{- end }}
{{- end }}
{{- if $showAuthorPhoto }}
<div class="author_header">
<img src="{{ absURL $author.photo }}" alt="{{ $author.name }} photo">
<h3>{{ $author.name }}</h3>
</div>
{{- else }}
<h3>{{ if $fullAuthor }}{{ $author.name }}{{ else }}{{ $author }}{{ end }}</h3>
{{- end }}
<div class="author_bio">
{{ markdownify $s.IntroDescription }}
</div>
{{- if ( ne $s.introURL false ) }}
{{- $r := T "read_more" }}
<a href='{{ absLangURL (default "about/" $s.introURL) }}' class="button mt-1" role="button" title='{{ $r }}'>{{ $r }}</a>
{{- end }}
{{- end }}
<div id="nav-posts">
{{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.mainSections }}
{{- $featured := default 8 $s.numberOfFeaturedPosts }}
{{- with first $featured (where $posts "Params.featured" true)}}
<h3 class="mt-4">{{ T "featured_posts" }}</h3>
{{- range . }}
<a href="{{ .Permalink }}" class="nav-link" title="{{ .Title }}">{{ .Title }}</a>
{{- end }}
{{- end }}
<h3 class="mt-4">{{ T "recent_posts" }}</h3>
{{- $recent := default 8 $s.numberOfRecentPosts }}
{{- range first $recent $posts.ByLastmod.Reverse }}
<a href="{{ .Permalink }}" class="nav-link" title="{{ .Title }}">{{ .Title }}</a>
{{- end }}
<h3 class="mt-4">{{ T "recurrent" }}</h3>
{{- $posts := where .Site.RegularPages "Params.recurrent" true }}
{{ range $posts }}
<a href="{{ .Permalink }}" class="nav-link" title="{{ .Title }}">{{ .Title }}</a>
{{ end }}
</div>
{{- $tagsLimit := (default 100 $s.numberOfTagsShown) }}
{{- range $key, $value := .Site.Taxonomies }}
{{- if gt $value 0 }}
<div>
<h3 class="mt-4 taxonomy" id="{{ $key }}-section">{{ T $key }}</h3>
<nav class="tags_nav">
{{- $onPageTags := $.Page.Params.tags }}
{{- $slicedTags := ($value.ByCount | first $tagsLimit) }}
{{- range $slicedTags }}
<a href='{{ absLangURL $key }}/{{ (replace .Name "#" "%23") | urlize }}/' class="post_tag button button_translucent" title="{{ .Name }}">
{{ $translated := .Name | T }}
{{ if $translated }}
{{ $translated }}
{{ else}}
{{ .Name | humanize }}
{{ end }}
<span class="button_tally">{{ .Count }}</span>
</a>
{{ end }}
{{ if gt (len $value.ByCount) $tagsLimit }}
<br>
<div class="post_tags_toggle button">{{ T (printf "all_%s" (lower $key)) }}</div>
{{- $tagsInfo := newScratch }}
<div class="post_tags">
<div class="tags_list">
{{- range $value.Alphabetical }}
{{ $tagsInfo.Add "tagsInfo" (slice .Name .Count)}}
<a href='{{ absLangURL $key }}/{{ (replace .Name "#" "%23") | urlize }}/' class=" post_tag button button_translucent" data-position={{ .Count }} title="{{ .Name }}">
{{- .Name | humanize -}}
<span class="button_tally">{{ .Count }}</span>
</a>
{{ end }}
<div class="tags_sort"><span title="sort alphabetically">[A~Z]</span><span title="sort by count">[0~9]</span>
</div>
<span class="tags_hide"><svg class="icon">
<use xlink:href="#closeme"></use>
</svg></span>
</div>
</div>
{{- end }}
</nav>
</div>
{{- end }}
{{- end }}
</section>