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;
& > :last-child {
margin-bottom: 0;
margin-bottom: 0 !important;
}
& > p > img {
@ -157,6 +157,50 @@ nav {
article {
display: flex;
& > .image {
display: none;
& > img {
height: auto;
width: 100%;
}
@media screen and (min-width: $small) {
display: block;
}
}
&.preview {
margin-bottom: 3rem;
& > .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%;
@ -164,21 +208,6 @@ article {
width: 40%;
}
}
& > .image {
display: none;
text-align: right;
@media screen and (min-width: $small) {
display: block;
padding-left: 1.5em;
width: 60%;
& > img {
height: auto;
width: 100%;
}
}
}
}
@ -219,6 +248,14 @@ hr {
}
}
.date {
margin-bottom: 0;
@media screen and (min-width: $small) {
margin-bottom: 0.5em;
}
}
.nav-burger {
cursor: pointer;
display: flex;

View File

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

View File

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

View File

@ -1,11 +1,20 @@
{{ define "main" }}
{{ .Content }}
{{ $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 }}
<h1><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
{{ .Content }}
{{ if ne .Slug (index (last 1 $pagination.Pages) 0).Slug }}<hr>{{ end }}
<p class="date">{{ index $days (.Date.Format "Monday") }}, {{ .Date.Format "02" }}. {{ index $months (.Date.Format "January") }} {{ .Date.Format "2006" }}</p>
{{ $page := . }}
<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 }}
{{ with $pagination }}
{{ if gt .TotalPages 1 }}