Add blog posts to front page

This commit is contained in:
Luca 2023-03-11 16:04:10 +01:00
parent 4abc52a274
commit fb14b39f4a
4 changed files with 68 additions and 20 deletions

View File

@ -91,7 +91,7 @@ main {
padding: 1rem; padding: 1rem;
& > :last-child { & > :last-child {
margin-bottom: 0; margin-bottom: 0 !important;
} }
& > p > img { & > p > img {
@ -157,26 +157,55 @@ nav {
article { article {
display: flex; display: flex;
& > .text {
width: 100%;
@media screen and (min-width: $small) {
width: 40%;
}
}
& > .image { & > .image {
display: none; display: none;
text-align: right;
& > img {
height: auto;
width: 100%;
}
@media screen and (min-width: $small) { @media screen and (min-width: $small) {
display: block; display: block;
padding-left: 1.5em; }
width: 60%; }
& > img { &.preview {
height: auto; margin-bottom: 3rem;
width: 100%;
& > .image {
align-items: center;
height: 200px;
justify-content: center;
overflow: hidden;
padding-right: 1.5rem;
width: 200px;
@media screen and (min-width: $small) {
display: flex;
}
}
& > .text {
flex-grow: 1;
}
}
&.page {
& > .image {
text-align: right;
@media screen and (min-width: $small) {
padding-left: 1.5em;
width: 60%;
}
}
& > .text {
width: 100%;
@media screen and (min-width: $small) {
width: 40%;
} }
} }
} }
@ -219,6 +248,14 @@ hr {
} }
} }
.date {
margin-bottom: 0;
@media screen and (min-width: $small) {
margin-bottom: 0.5em;
}
}
.nav-burger { .nav-burger {
cursor: pointer; cursor: pointer;
display: flex; display: flex;

View File

@ -7,3 +7,5 @@ menu:
![kontakt Das Kulturfestival (Symbolbild)](/symbolbild.jpg) ![kontakt Das Kulturfestival (Symbolbild)](/symbolbild.jpg)
by [ChrisU](https://instagram.com/chrisu_photography) by [ChrisU](https://instagram.com/chrisu_photography)
# Aktuelles

View File

@ -2,7 +2,7 @@
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
{{ $textContent := .Content }} {{ $textContent := .Content }}
{{ with .Resources.GetMatch "image.jpg" }} {{ with .Resources.GetMatch "image.jpg" }}
<article> <article class="page">
<section class="text">{{ $textContent }}</section> <section class="text">{{ $textContent }}</section>
<section class="image"> <section class="image">
<img alt="{{ .Title }}" src="{{ .RelPermalink }}"> <img alt="{{ .Title }}" src="{{ .RelPermalink }}">

View File

@ -1,11 +1,20 @@
{{ define "main" }} {{ define "main" }}
{{ .Content }} {{ .Content }}
{{ $pagination := .Paginate .RegularPages }} {{ $pagination := .Paginate .RegularPages }}
{{ with .Content }}{{ with $pagination.Pages }}<hr>{{ end }}{{ end }} {{ $days := dict "Monday" "Mo" "Tuesday" "Di" "Wednesday" "Mi" "Thursday" "Do" "Friday" "Fr" "Saturday" "Sa" "Sunday" "So" }}
{{ $months := dict "January" "Januar" "February" "Februar" "March" "März" "April" "April" "May" "Mai" "June" "Juni" "July" "Juli" "August" "August" "September" "September" "October" "Oktober" "November" "November" "December" "Dezember" }}
{{ range $pagination.Pages }} {{ range $pagination.Pages }}
<h1><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1> <p class="date">{{ index $days (.Date.Format "Monday") }}, {{ .Date.Format "02" }}. {{ index $months (.Date.Format "January") }} {{ .Date.Format "2006" }}</p>
{{ .Content }} {{ $page := . }}
{{ if ne .Slug (index (last 1 $pagination.Pages) 0).Slug }}<hr>{{ end }} <article class="preview">
{{ with .Resources.GetMatch "image.jpg" }}
<section class="image"><img alt="{{ .Title }}" src="{{ .RelPermalink }}"></section>
{{ end }}
<section class="text">
<h2><a href="{{ $page.RelPermalink }}">{{ $page.Title }}</a></h2>
{{ $page.Summary }}
</section>
</article>
{{ end }} {{ end }}
{{ with $pagination }} {{ with $pagination }}
{{ if gt .TotalPages 1 }} {{ if gt .TotalPages 1 }}