From c06c8603efdb209f3595220a8d717a4cde3ac26e Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Mon, 18 Nov 2024 12:21:04 +0100 Subject: [PATCH] Improve blog post display * Add a post date to each post * Do not show the post date for tours * Only show posts tagged "current-event" on the home page (hiding 37c3 entries) * Use a custom template for sorting the summary list by title (instead of the default by date) --- assets/sass/_custom.scss | 5 +++++ content/de/37c3/_index.md | 5 ++++- content/de/38c3/_index.md | 7 ++++++- content/de/posts/2024-10-01-coming-up.md | 3 +++ content/de/posts/2024-11-18-shop-open.md | 3 +++ content/de/posts/_index.md | 1 + content/en/37c3/_index.md | 5 ++++- content/en/38c3/_index.md | 5 ++++- content/en/_index.md | 1 + content/en/posts/2024-10-01-coming-up.md | 3 +++ content/en/posts/2024-11-18-shop-open.md | 3 +++ content/en/posts/_index.md | 1 + hugo.yaml | 2 ++ .../baseof.html => _default/home-baseof.html} | 0 .../list.html => _default/list-bytitle.html} | 0 layouts/_default/summary.html | 12 ++++++++++++ layouts/index.html | 15 +++++++++++++++ 17 files changed, 67 insertions(+), 4 deletions(-) rename layouts/{home/baseof.html => _default/home-baseof.html} (100%) rename layouts/{tours/list.html => _default/list-bytitle.html} (100%) create mode 100644 layouts/_default/summary.html create mode 100644 layouts/index.html diff --git a/assets/sass/_custom.scss b/assets/sass/_custom.scss index a73aab4..b0824af 100644 --- a/assets/sass/_custom.scss +++ b/assets/sass/_custom.scss @@ -11,4 +11,9 @@ table, th, td { th, td { padding: 3px 6px; font-variant-numeric: tabular-nums; +} + +.title-post-date { + font-size: .7em; + margin-left: 2em; } \ No newline at end of file diff --git a/content/de/37c3/_index.md b/content/de/37c3/_index.md index 624f03a..593246f 100644 --- a/content/de/37c3/_index.md +++ b/content/de/37c3/_index.md @@ -1,7 +1,10 @@ --- title: 37c3 Touren weight: 10 -type: tours +layout: list-bytitle +cascade: + params: + showPostDate: false --- diff --git a/content/de/38c3/_index.md b/content/de/38c3/_index.md index 6f59933..aa20484 100644 --- a/content/de/38c3/_index.md +++ b/content/de/38c3/_index.md @@ -1,10 +1,15 @@ --- title: 38c3 Touren weight: 10 -type: tours +layout: list-bytitle menus: main: name: Touren +params: + showPostDate: false +cascade: + params: + showPostDate: false --- Diese Touren bieten wir zum 38c3 Chaos Communication Congress an: diff --git a/content/de/posts/2024-10-01-coming-up.md b/content/de/posts/2024-10-01-coming-up.md index 3d96099..3053699 100644 --- a/content/de/posts/2024-10-01-coming-up.md +++ b/content/de/posts/2024-10-01-coming-up.md @@ -1,6 +1,9 @@ --- title: 'Freut euch auf die Touren beim 38c3!' date: 2024-10-31T09:00:00+01:00 +tags: + - current-event + - 38c3 --- Wir bereiten auch für den 38c3 Touren vor. Sobald wir die Details ausgearbeitet haben, erfahrt ihr hier mehr. diff --git a/content/de/posts/2024-11-18-shop-open.md b/content/de/posts/2024-11-18-shop-open.md index ed8f225..0b51dc2 100644 --- a/content/de/posts/2024-11-18-shop-open.md +++ b/content/de/posts/2024-11-18-shop-open.md @@ -1,6 +1,9 @@ --- title: 'Der Shop hat auf für den 38c3!' date: 2024-11-18T09:00:00+01:00 +tags: + - current-event + - 38c3 --- (Fast) alle Touren sind hier auf [der Website](../38c3/), und ihr könnt Plätze für die Touren [im Shop buchen](https://tickets.hamburg.ccc.de/hackertours/38c3/)! In den nächsten Wochen werden wir die Touren auf Mastodon [@hackertours@chaos.social](https://chaos.social/@hackertours) vorstellen, folgt uns also dort. diff --git a/content/de/posts/_index.md b/content/de/posts/_index.md index 51549d2..9492aa2 100644 --- a/content/de/posts/_index.md +++ b/content/de/posts/_index.md @@ -1,5 +1,6 @@ --- title: News +type: posts weight: 2 menus: main diff --git a/content/en/37c3/_index.md b/content/en/37c3/_index.md index cec3d54..3637392 100644 --- a/content/en/37c3/_index.md +++ b/content/en/37c3/_index.md @@ -1,7 +1,10 @@ --- title: 37c3 Tours weight: 10 -type: tours +layout: list-bytitle +cascade: + params: + showPostDate: false --- diff --git a/content/en/38c3/_index.md b/content/en/38c3/_index.md index 52d27d2..3a630a3 100644 --- a/content/en/38c3/_index.md +++ b/content/en/38c3/_index.md @@ -1,10 +1,13 @@ --- title: 38c3 Tours weight: 10 -type: tours +layout: list-bytitle menus: main: name: Tours +cascade: + params: + showPostDate: false --- These are the tours on offer for 38c3 Chaos Communication Congress: diff --git a/content/en/_index.md b/content/en/_index.md index 54bcd86..f223c1a 100644 --- a/content/en/_index.md +++ b/content/en/_index.md @@ -24,3 +24,4 @@ This year we have found interesting places in and around Hamburg where you can d Hackertours Desk: DECT 8687 "TOUR", +49 40 573 0830 8687, Foyer X, next to the white grandfather clock # News + \ No newline at end of file diff --git a/content/en/posts/2024-10-01-coming-up.md b/content/en/posts/2024-10-01-coming-up.md index 8fd29aa..e50ff4f 100644 --- a/content/en/posts/2024-10-01-coming-up.md +++ b/content/en/posts/2024-10-01-coming-up.md @@ -1,6 +1,9 @@ --- title: 'Get excited about the tours at 38c3!' date: 2024-10-31T09:00:00+01:00 +tags: + - current-event + - 38c3 --- We are preparing tours again for 38c3. As soon as we have nailed down the details, we'll let you know here. diff --git a/content/en/posts/2024-11-18-shop-open.md b/content/en/posts/2024-11-18-shop-open.md index 9f48aec..00f26ea 100644 --- a/content/en/posts/2024-11-18-shop-open.md +++ b/content/en/posts/2024-11-18-shop-open.md @@ -1,6 +1,9 @@ --- title: 'The shop is open for 38c3!' date: 2024-11-18T09:00:00+01:00 +tags: + - current-event + - 38c3 --- (Almost) all tours are on this [website](../38c3/), and [the shop](https://tickets.hamburg.ccc.de/hackertours/38c3/) is open for you to book a spot on one of the tours! Over the coming weeks, we will highlight the tours on Mastodon [@hackertours@chaos.social](https://chaos.social/@hackertours), so be sure to follow us there. diff --git a/content/en/posts/_index.md b/content/en/posts/_index.md index 510d6f3..2d8db70 100644 --- a/content/en/posts/_index.md +++ b/content/en/posts/_index.md @@ -1,5 +1,6 @@ --- title: News +type: posts weight: 2 menus: main: diff --git a/hugo.yaml b/hugo.yaml index 32d2dbb..c756574 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -11,8 +11,10 @@ ignoreLogs: params: contact: "hackertours@hamburg.ccc.de" copyright: "[CCC Hansestadt Hamburg e.V.](https://hamburg.ccc.de) ist nur der Vermittler der Touren. Für das Angebot und die Durchführung der Touren sind die jeweiligen Veranstalter verantwortlich." + dateFormat: "02.03.2006 15:04" description: "Hamburg Hackertours" footer: "[Impressum & Datenschutz](https://hamburg.ccc.de/imprint/) – [Ticket Shop](https://tickets.hamburg.ccc.de/hackertours/38c3/)" + showPostDate: true logo: true logoPath: img/hackertours-2024-color.svg logoHeight: 100 diff --git a/layouts/home/baseof.html b/layouts/_default/home-baseof.html similarity index 100% rename from layouts/home/baseof.html rename to layouts/_default/home-baseof.html diff --git a/layouts/tours/list.html b/layouts/_default/list-bytitle.html similarity index 100% rename from layouts/tours/list.html rename to layouts/_default/list-bytitle.html diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html new file mode 100644 index 0000000..58ec9b8 --- /dev/null +++ b/layouts/_default/summary.html @@ -0,0 +1,12 @@ +
+
+{{- $postDate := "" }} +{{- if .Param "showPostDate" | default false }} +{{- $postDate = .Params.date.Format .Site.Params.dateFormat }} +{{- end }} +

{{ .Title }}

+{{ if $.Param "submitted" | default false }}{{ partial "submitted.html" . -}}{{ end }} +
+ +{{ .Summary }} +
diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..ec93d88 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,15 @@ +{{ define "title" }}{{ site.Title }}{{ end }} + +{{ define "main" -}} +
+{{ .Content }} + +{{ $pages := .Site.RegularPages.RelatedTo (keyVals "tags" "current-event") -}} +{{ $paginator := .Paginate $pages -}} +{{ range $paginator.Pages -}} +{{ .Render "summary" }} +{{ end -}} + +{{ partial "pagination.html" . }} +
+{{ end -}}