From fb14b39f4a405704338c1f354ff89779c08d5734 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 11 Mar 2023 16:04:10 +0100 Subject: [PATCH] Add blog posts to front page --- assets/style.scss | 67 ++++++++++++++++++++++++++++-------- content/_index.md | 2 ++ layouts/_default/single.html | 2 +- layouts/index.html | 17 ++++++--- 4 files changed, 68 insertions(+), 20 deletions(-) diff --git a/assets/style.scss b/assets/style.scss index f92fe3f..b5719d6 100644 --- a/assets/style.scss +++ b/assets/style.scss @@ -91,7 +91,7 @@ main { padding: 1rem; & > :last-child { - margin-bottom: 0; + margin-bottom: 0 !important; } & > p > img { @@ -157,26 +157,55 @@ nav { article { display: flex; - & > .text { - width: 100%; - - @media screen and (min-width: $small) { - width: 40%; - } - } - & > .image { display: none; - text-align: right; + + & > img { + height: auto; + width: 100%; + } @media screen and (min-width: $small) { display: block; - padding-left: 1.5em; - width: 60%; + } + } - & > img { - height: auto; - width: 100%; + &.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%; + + @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 { cursor: pointer; display: flex; diff --git a/content/_index.md b/content/_index.md index 24b4994..49aa3e6 100644 --- a/content/_index.md +++ b/content/_index.md @@ -7,3 +7,5 @@ menu: ![kontakt – Das Kulturfestival (Symbolbild)](/symbolbild.jpg) by [ChrisU](https://instagram.com/chrisu_photography) + +# Aktuelles diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3764a49..ae9e933 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,7 +2,7 @@

{{ .Title }}

{{ $textContent := .Content }} {{ with .Resources.GetMatch "image.jpg" }} -
+
{{ $textContent }}
{{ .Title }} diff --git a/layouts/index.html b/layouts/index.html index c25577e..952c9d1 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,11 +1,20 @@ {{ define "main" }} {{ .Content }} {{ $pagination := .Paginate .RegularPages }} -{{ with .Content }}{{ with $pagination.Pages }}
{{ 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 }} -

{{ .Title }}

-{{ .Content }} -{{ if ne .Slug (index (last 1 $pagination.Pages) 0).Slug }}
{{ end }} +

{{ index $days (.Date.Format "Monday") }}, {{ .Date.Format "02" }}. {{ index $months (.Date.Format "January") }} {{ .Date.Format "2006" }}

+{{ $page := . }} +
+{{ with .Resources.GetMatch "image.jpg" }} +
{{ .Title }}
+{{ end }} +
+

{{ $page.Title }}

+ {{ $page.Summary }} +
+
{{ end }} {{ with $pagination }} {{ if gt .TotalPages 1 }}