Initialisierung
This commit is contained in:
parent
4084518848
commit
6dd9fa38f6
116 changed files with 17349 additions and 2 deletions
109
layouts/blog/list.html
Normal file
109
layouts/blog/list.html
Normal file
|
@ -0,0 +1,109 @@
|
|||
{{ 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="col-md6 px-0">
|
||||
<h1 class="display-4 fst-italic">{{ $latestEntry.Title }}</h1>
|
||||
<p class="lead my-3">{{ $latestEntry.Summary }}</p>
|
||||
<p class="lead mb-0"><a href="{{ $latestEntry.Permalink }}" class="text-white fw-bold">Weiter lesen...</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
{{/* Paginator initialisieren, in der Reihenfolge die man sich im Blog wünscht */}}
|
||||
{{ if eq .Type "blog" }}
|
||||
{{/* Der 1te Weg soll alle Blog-Einträge finden*/}}
|
||||
{{ $pag := .Paginate (where .Site.RegularPages "Type" "blog").ByPublishDate.Reverse 3 }}
|
||||
{{ else }}
|
||||
{{/* Der 2te Weg ist über die Archive-Gruppierung, und dort wird nicht paginiert */}}
|
||||
{{ $pag := .Paginate .Pages.ByPublishDate.Reverse 9999 }}
|
||||
{{ end }}
|
||||
{{/* Der Paginator wurde in den If-Blöcken zwar erstellt, aber die Variable ist auserhalb nicht sichtbar, daher hier explizit holen.
|
||||
Dieser kann nach dem ersten erstellen auch nicht mehr verändert werden */}}
|
||||
{{ $pag := .Paginator }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ range $pag.Pages }}
|
||||
<article class="blog-post">
|
||||
<h2 class="blog-post-title mb-1"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
|
||||
<p class="blog-post-meta">{{ partial "metadata.html" . }}</p>
|
||||
<p>{{ .Summary }}</p>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ template "partials/pagination.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ 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">
|
||||
{{ $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>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ 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">
|
||||
{{ $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 -->
|
||||
<a class="tag-cloud-link" style="{{ printf "font-size: %.3frem" (add (mul (math.Pow (div (sub $sites.Count $minCnt) $div) 2.0) 0.4) 1.0) }};" href="{{ $parentLink | relURL }}{{ $key | urlize }}" aria-label="{{- $key -}} ({{- $sites.Count -}} Einträge)">
|
||||
{{- $key -}}<sup>{{ $sites.Count }}</sup>
|
||||
</a>
|
||||
<!--<span class="badge">{{ $sites.Count }}</span>-->
|
||||
|
||||
{{ end }}
|
||||
</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">
|
||||
{{/* Hier explizit auf Type achten!! */}}
|
||||
{{ range (where .Site.RegularPages "Type" "blog").GroupByDate "2006" }}
|
||||
<li><a href="/blog/{{ .Key }}">Year {{ .Key }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
25
layouts/blog/single.html
Normal file
25
layouts/blog/single.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{ define "main" }}
|
||||
<section class="section">
|
||||
<article>
|
||||
<div class="columns is-centered">
|
||||
<div class="column">
|
||||
<h1 class="title is-1">{{ .Title }}</h1>
|
||||
<div class="blog-post-meta">{{ partial "metadata.html" . }}</div>
|
||||
<div class="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div class="blog-post-meta mt-5">{{ partial "metafooter.html" . }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ define "sidebar" }}
|
||||
<aside class="position-sticky" style="top: 2rem;">
|
||||
<div class="p-4">
|
||||
{{ .TableOfContents }}
|
||||
</div>
|
||||
</aside>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue