Sticky-Position verallgemeinert

This commit is contained in:
mdn 2022-11-28 19:45:15 +01:00
parent b5c29695ff
commit ac8d277899
5 changed files with 20 additions and 11 deletions

View file

@ -54,6 +54,14 @@ footer p {
fill_: currentColor;
}
/*
* Sidebar
*/
.position-sticky {
top: .5rem;
margin-bottom: .5rem!important;
}
/*
* Blog posts

View file

@ -10,7 +10,7 @@
{{ end }}
{{ define "sidebar" }}
<div class="position-sticky" style="top: 0.5rem;">
<div class="position-sticky">
{{- partial "widget/header.html" (dict "title" "About Me") -}}
{{- partial "widget/aboutme.html" (dict "avatar" .Site.Params.Avatar "description" .Site.Params.Description) -}}

View file

@ -4,7 +4,7 @@
{{ end }}
{{ define "sidebar" }}
<div class="position-sticky" style="top: 0.5rem;">
<div class="position-sticky">
{{- partial "widget/header.html" (dict "title" "About Me") -}}
{{- partial "widget/aboutme.html" (dict "avatar" .Site.Params.Avatar "description" .Site.Params.Description) -}}

View file

@ -1,14 +1,16 @@
{{ define "head" }}
{{ if eq .Type "blog" }}
{{ $latestEntry := index (where (where .Site.RegularPages "Type" "blog") "Params.featured" true).ByPublishDate.Reverse 0 }}
{{ with $latestEntry }}
<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>
<p class="lead mb-0"><a href="{{ $latestEntry.Permalink }}" class="text-white fw-bold">Weiter lesen...</a></p>
<h1 class="display-4 fst-italic">{{ .Title }}</h1>
<p class="lead my-3">{{ .Summary | safeHTML }}</p>
<p class="lead mb-0"><a href="{{ .RelPermalink }}" class="text-white fw-bold">Weiter lesen...</a></p>
</div>
</div>
{{ end }}
{{ end }}
{{ end }}
{{ define "main" }}
@ -17,8 +19,8 @@
{{/* Der 1te Weg soll alle Blog-Einträge finden*/}}
{{ $pag := .Paginate (where .Site.RegularPages "Type" "blog").ByPublishDate.Reverse }}
{{ else }}
{{/* Der 2te Weg ist über die Archive-Gruppierung, und dort wird nicht paginiert */}}
{{ $pag := .Paginate .Pages.ByPublishDate.Reverse 9999 }}
{{/* Der 2te Weg ist über die Archive-Gruppierung */}}
{{ $pag := .Paginate .Pages.ByPublishDate.Reverse }}
{{ 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 */}}
@ -35,7 +37,7 @@
{{ end }}
{{ define "sidebar" }}
<div class="position-sticky" style="top: 0.5rem;">
<div class="position-sticky">
{{ $catIdent := .Site.Params.Blog.Categories | default "categories" }}
{{ $cats := (index $.Site.Taxonomies $catIdent)}}
{{ if $cats }}

View file

@ -15,9 +15,8 @@
</section>
{{ end }}
{{ define "sidebar" }}
<aside class="position-sticky" style="top: 0.5rem;">
<aside class="position-sticky">
{{- partial "widget/header.html" (dict "title" "Inhaltsverzeichnis")}}
<div>
{{ .TableOfContents }}