Kategorie + Archive und Hauptseite
This commit is contained in:
parent
2f15333242
commit
f2b5de5575
5 changed files with 74 additions and 72 deletions
|
@ -1,7 +1,7 @@
|
|||
{{ define "head" }}
|
||||
{{ if eq .Type "blog" }}
|
||||
{{ $latestEntry := index (where (where .Site.RegularPages "Type" "blog") "Params.featured" true).ByPublishDate.Reverse 0 }}
|
||||
<div class="p-4 p-md-5 m-2 mb-4 rounded text-bg-dark">
|
||||
<div class="p-4 m-2 rounded text-bg-dark">
|
||||
<div class="col-md6 px-0">
|
||||
<h1 class="display-4 fst-italic">{{ $latestEntry.Title }}</h1>
|
||||
<p class="lead my-3">{{ $latestEntry.Summary | safeHTML }}</p>
|
||||
|
@ -38,47 +38,36 @@
|
|||
{{ define "sidebar" }}
|
||||
<div class="position-sticky blog-sidebar" style="top: 2rem;">
|
||||
<div class="p-4">
|
||||
{{/* range $tax := .Site.Params.Blog.Taxonomies }}
|
||||
{{ $taxUrl := $.Site.GetPage (printf "/%s" $tax) }}
|
||||
<h4 class="fst-italic"><a href="{{- $taxUrl.Permalink -}}">{{ $tax }}</a></h4>
|
||||
<ul class="mb-2">
|
||||
{{ $parentLink := (printf "/%s/" $tax) }}
|
||||
{{ $x := (index $.Site.Taxonomies "tags") }}
|
||||
|
||||
{{ range (index $.Site.Taxonomies $tax) }}
|
||||
{{ printf "%#v" . }}
|
||||
<li><a href="{{/* (printf "%s%s" $parentLink $key) * /}}">{{/* $key * /}}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end */}}
|
||||
|
||||
{{ $catIdent := .Site.Params.Blog.Categories | default "categories" }}
|
||||
{{ $cats := (index $.Site.Taxonomies $catIdent)}}
|
||||
{{ if $cats }}
|
||||
<h4 class="fst-italic">Kategorien</h4>
|
||||
<ul class="mb-2">
|
||||
<h4 class="fst-italic border-bottom border-dark mt-2">Kategorien</h4>
|
||||
<div class="categories mb-2 d-inline-block">
|
||||
{{ $parentLink := ($.Site.GetPage (printf "/categories")).Permalink }}
|
||||
{{ range $key, $sites := $cats }}
|
||||
<li><a href="{{ (printf "%s%s" $parentLink $key) }}">{{ $key }}</a> <small>({{ $sites.Count }})</small></li>
|
||||
<div class="m-1 d-inline-flex">
|
||||
<a class="bg-dark text-white py-1 px-2 m-0 rounded-start" href="{{ (printf "%s%s" $parentLink $key) }}">{{ $key }}</a>
|
||||
<div class="bg-danger text-white py-1 px-2 m-0 rounded-end">{{ $sites.Count }}</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{/* https://mertbakir.gitlab.io/hugo/tag-cloud-in-hugo/ */}}
|
||||
{{ $tagsIdent := .Site.Params.Blog.Tags | default "tags" }}
|
||||
{{ $tags := (index $.Site.Taxonomies $tagsIdent)}}
|
||||
{{ if $tags }}
|
||||
<h4 class="fst-italic">Schlagwortwolke</h4>
|
||||
<div class="tag-cloud">
|
||||
<h4 class="fst-italic border-bottom border-dark mt-2">Schlagwortwolke</h4>
|
||||
<div class="tag-cloud d-inline-block m-0 p-0">
|
||||
{{ $parentLink := ($.Site.GetPage (printf "/%s" $tagsIdent)).Permalink }}
|
||||
{{ $maxCnt := mul 1.0 (index $tags.ByCount 0).Count }}
|
||||
{{ $minCnt := mul 1.0 (index $tags.ByCount.Reverse 0).Count }}
|
||||
{{ $div := math.Max 1 (sub $maxCnt $minCnt) }}
|
||||
{{ range $key, $sites := $tags }}
|
||||
<!-- add (mul (math.Pow (div $sites.Count $maxCnt) 2.0) 14.0) 8.0 px -->
|
||||
{{- (printf `<a class="tag-cloud-link" style="font-size: %.3frem;" href="%s" aria-label="%s %d Einträge">%s<sup>%d</sup></a>`
|
||||
{{- (printf `<a class="tag-cloud-link m-1 p-1" style="font-size: %.3frem;" href="%s" aria-label="%s %d Einträge">%s<sup>%d</sup></a>`
|
||||
(add (mul (math.Pow (div (sub $sites.Count $minCnt) $div) 2.0) 0.6) 0.8)
|
||||
($parentLink | relURL) $key $sites.Count $key $sites.Count
|
||||
($key | relURL) $key $sites.Count $key $sites.Count
|
||||
) | safeHTML -}}
|
||||
<!--<span class="badge">{{ $sites.Count }}</span>-->
|
||||
|
||||
|
@ -86,25 +75,13 @@
|
|||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{/* range $taxonomy_term, $taxonomy := .Site.Taxonomies }}
|
||||
{{ with $.Site.GetPage (printf "/%s" $taxonomy_term) }}
|
||||
<h4 class="fst-italic"><a class="text-decoration-none" href="{{ .Permalink }}">{{ $taxonomy_term }}</a></h4>
|
||||
<ul class="mb-2">
|
||||
{{ $parentLink := .Permalink }}
|
||||
{{ range $key, $sites := $taxonomy }}
|
||||
<li><a href="{{ (printf "%s%s" $parentLink $key) }}">{{ $key }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ end */}}
|
||||
|
||||
<h4 class="fst-italic">Archive</h4>
|
||||
<ul class="mb-2">
|
||||
<h4 class="fst-italic border-bottom border-dark mt-2">Archive</h4>
|
||||
<div class="mb-2 list-group">
|
||||
{{/* Hier explizit auf Type achten!! */}}
|
||||
{{ range (where .Site.RegularPages "Type" "blog").GroupByDate "2006" }}
|
||||
<li><a href="/blog/{{ .Key }}">Year {{ .Key }}</a></li>
|
||||
<a class="list-group-item list-group-item-action" href="/blog/{{ .Key }}">Jahr {{ .Key }}</a>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue