[FEATURE] Blog: make the blog posts looks much nicer and add a header image

This commit is contained in:
christian 2023-10-29 22:05:09 +01:00 committed by jtbx
parent abf85cec0f
commit 2710137012
6 changed files with 69 additions and 16 deletions

View file

@ -6,6 +6,9 @@ draft: true
authors: authors:
- your name - your name
# tags: # tags:
# header:
# caption: A caption für the picture will be used as Alt-Text
# image: Path to the image
--- ---
TODO: Write your blog post TODO: Write your blog post

View file

@ -8,6 +8,9 @@ location: Z9
authors: authors:
- your name - your name
# tags: # tags:
# header:
# caption: A caption für the picture will be used as Alt-Text
# image: Path to the image
--- ---
TODO: Describe your event here TODO: Describe your event here

View file

@ -30,6 +30,7 @@ header {
body>footer { body>footer {
padding-top: var(--spacing); padding-top: var(--spacing);
padding-bottom: var(--spacing); padding-bottom: var(--spacing);
nav { nav {
ul { ul {
display: flex; display: flex;
@ -76,7 +77,7 @@ body>main {
} }
.morelink { .morelink {
margin-top: calc(var(--typography-spacing-vertical) * -1); margin-top: calc(var(--typography-spacing-vertical) * -0.5);
} }
.pagination { .pagination {
@ -154,16 +155,16 @@ body>main {
.announcement { .announcement {
border-radius: var(--border-radius); border-radius: var(--border-radius);
background: var(--code-background-color); background: var(--code-background-color);
padding: 10px 15px;
margin-bottom: var(--typography-spacing-vertical); margin-bottom: var(--typography-spacing-vertical);
padding-bottom: 1rem;
header { header {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
p { p {
margin-bottom: calc(var(--typography-spacing-vertical) / 2); margin: 0 1rem;
} }
// .morelink { // .morelink {
@ -255,7 +256,6 @@ body>main {
} }
// Blog Overview: Categories list // Blog Overview: Categories list
div.nav-aside { div.nav-aside {
ul { ul {
@ -268,3 +268,47 @@ div.nav-aside {
} }
} }
} }
.blog-header {
// General Customizations
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border: 5px solid var(--muted-border-color);
background-color: var(--muted-border-color);
padding-bottom: 10px;
h1,
h2,
h3,
h4,
h5,
h6,
div {
margin: 15px var(--block-spacing-horizontal);
}
img {
padding: 15px var(--block-spacing-horizontal);
width: 100%;
height: 25cqw;
object-fit: cover;
object-position: top;
}
}
.blog {
background-color: var(--card-background-color);
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
border: 2px solid var(--card-background-color);
padding-bottom: 0;
}
article.blog {
padding-bottom: var(--block-spacing-vertical);
}
article>header {
padding: unset;
}

View file

@ -1,8 +1,7 @@
<article class="blog">
<article>
{{- partial "blog-header.html" (dict "headingLink" true "level" 2 "page" . ) }} {{- partial "blog-header.html" (dict "headingLink" true "level" 2 "page" . ) }}
<section>
{{- if in .RawContent "<!--more-->" }} {{- if in .RawContent "<!--more--> " }}
{{ .Summary | safeHTML }} {{ .Summary | safeHTML }}
{{- else }} {{- else }}
<p>{{ .Summary | safeHTML }}</p> <p>{{ .Summary | safeHTML }}</p>
@ -10,4 +9,5 @@
{{- if .Truncated }} {{- if .Truncated }}
<div class="morelink"><a href="{{ .RelPermalink }}">mehr...</a></div> <div class="morelink"><a href="{{ .RelPermalink }}">mehr...</a></div>
{{- end }} {{- end }}
</section>
</article> </article>

View file

@ -1,8 +1,9 @@
{{ define "main" }} {{ define "main" }}
<main class="container" aria-role="main"> <main class="container" aria-role="main">
<article class="blog">
{{- partial "blog-header.html" (dict "page" . ) }} {{- partial "blog-header.html" (dict "page" . ) }}
<section class="content"> <section>
{{ .Content }} {{ .Content }}
</section> </section>
@ -14,5 +15,6 @@
<small class="li-comma">letzte Änderung: {{ .Format "2006-01-02 15:04" }}</small> <small class="li-comma">letzte Änderung: {{ .Format "2006-01-02 15:04" }}</small>
{{- end }} {{- end }}
</div> </div>
</main> </article>
</main>
{{ end }} {{ end }}

View file

@ -5,7 +5,7 @@
{{- $showAuthors := not (.reduced | default false) -}} {{- $showAuthors := not (.reduced | default false) -}}
{{ with $page }} {{ with $page }}
<header> <header class="blog-header">
{{- if $headingLink }}<a href="{{ .RelPermalink }}">{{ end }} {{- if $headingLink }}<a href="{{ .RelPermalink }}">{{ end }}
<h{{ $level }}>{{ .Title }}</h{{ $level }}> <h{{ $level }}>{{ .Title }}</h{{ $level }}>
{{- if $headingLink }}</a>{{ end }} {{- if $headingLink }}</a>{{ end }}
@ -38,5 +38,6 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
</div> </div>
{{ if isset .Params "header" }} <img class="container" src="{{ .Params.header.image }}" alt="{{ .Params.header.caption }}" /> {{ end }}
</header> </header>
{{- end }} {{- end }}