From 8fef93f0da112b46a1f21dbcfed4fa3979b85f51 Mon Sep 17 00:00:00 2001 From: Vincent Mahnke Date: Sun, 8 Nov 2026 23:58:04 +0100 Subject: [PATCH] feat: Shows events as cards on the home page Replaces the line of links to previous events with cards after the 40C3 start page: each card has the event's logo (designs.events.ccc.de) in its heading bar, the motto, full name, dates and venue. 40C3 is greyed out as in progress; the other cards link to their tours. The events shortcode reads data/events.yaml; the README documents it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- README.md | 25 ++++++ assets/css/_custom.css | 1 + assets/css/_events.css | 149 ++++++++++++++++++++++++++++++++ assets/img/events/37c3.svg | 7 ++ assets/img/events/38c3.svg | 3 + assets/img/events/39c3.svg | 4 + assets/img/events/40c3.svg | 21 +++++ assets/img/events/Sources.txt | 18 ++++ assets/img/events/eh22.svg | 34 ++++++++ content/de/_index.md | 4 +- content/en/_index.md | 4 +- data/events.yaml | 36 ++++++++ i18n/de.yaml | 5 ++ i18n/en.yaml | 5 ++ layouts/_shortcodes/events.html | 82 ++++++++++++++++++ 15 files changed, 396 insertions(+), 2 deletions(-) create mode 100644 assets/css/_events.css create mode 100644 assets/img/events/37c3.svg create mode 100644 assets/img/events/38c3.svg create mode 100644 assets/img/events/39c3.svg create mode 100644 assets/img/events/40c3.svg create mode 100644 assets/img/events/Sources.txt create mode 100644 assets/img/events/eh22.svg create mode 100644 data/events.yaml create mode 100644 layouts/_shortcodes/events.html diff --git a/README.md b/README.md index b836837..0f229a4 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,31 @@ Without a data file, or without any tours in it, the shortcode renders nothing a Hugo crops the thumbnails to squares (keeping the most interesting part of the picture) at build time; the lightbox shows the original file. Without JavaScript, a thumbnail links to the original file. A missing image, a missing `alt` or a `gallery-image` outside a `gallery` stops the build with an error that names the page. +## Shortcode: Event cards + +The home page (`content/*/_index.md`) lists the events as cards with `{{< events >}}`, modelled on the cards of the [40C3 start page](https://events.ccc.de/congress/2026/infos/startpage.html). It reads `data/events.yaml`, which is shared by both languages, and shows the events in the order of the file, newest first: + +```yaml +events: + - event: 39c3 + title: { de: 39. Chaos Communication Congress, en: 39th Chaos Communication Congress } + motto: Power Cycles + start: "2025-12-27" + end: "2025-12-30" + venue: CCH +``` + +- `event` is the name of the event's section (`content/*//`), which the card links to. The card's heading shows it in capitals (`39C3`); `name` (optional) replaces that. +- `title` is the event's full name, with one entry per language, or one for both: `title: Easterhegg 2025`. +- `motto` and `venue` are shown as they are. +- `start` and `end` are `YYYY-MM-DD`. The card shows the range in the page's language, as on the 40C3 start page: `27.–30. Dezember 2025`, `27–30 December 2025`. Leave out `end` for a one-day event. +- `status` (optional): `inprogress` greys the card out, without a link, and marks it "In Vorbereitung" / "In progress", for an event whose tours aren't online yet. Remove it once the event's section exists. +- `credit` (optional) names the logo's authors and licence in Markdown, shown below the cards, for logos whose licence asks for it. + +The heading shows the event's logo, `assets/img/events/.svg`, in the text colour. The SVG's own colours are ignored, only its shape counts, so use a version without a background. Where each logo comes from, and its licence, is listed in [assets/img/events/Sources.txt](assets/img/events/Sources.txt). + +An event without a section, that isn't in progress either, gets a greyed-out card without a link, and the build logs a warning, as it does for a missing logo. Without a data file, or without any events in it, the shortcode renders nothing and the build logs a warning; to silence it, add `warning-events-empty` to `ignoreLogs` in `hugo.yaml`. + ## Accessibility check CI runs [pa11y-ci](https://github.com/pa11y/pa11y-ci) with the axe and HTML_CodeSniffer rules for WCAG 2 AA on every push and pull request, in its own job (`accessibility`), so findings show up without blocking the deploy. To run the same check locally (needs Node.js, Python 3 and Chrome or Chromium): diff --git a/assets/css/_custom.css b/assets/css/_custom.css index fbd0ff6..c0f3378 100644 --- a/assets/css/_custom.css +++ b/assets/css/_custom.css @@ -1,5 +1,6 @@ @import './_schedule.css'; @import './_gallery.css'; +@import './_events.css'; /* * 40C3 "MODEL_CITIZENS" design, after the 40C3 styleguide. diff --git a/assets/css/_events.css b/assets/css/_events.css new file mode 100644 index 0000000..8de5a73 --- /dev/null +++ b/assets/css/_events.css @@ -0,0 +1,149 @@ +/* + * Event cards on the home page (events shortcode), after the cards on the 40C3 start page + * (events.ccc.de/congress/2026/infos/startpage.html): a frame with a heading bar that holds the + * event's logo, drawn in the text colour like the start page's icons. Cards of past events link to + * their tours and fill the heading bar on hover and focus; an event in progress is greyed out. + */ + +.event-cards { + --event-card-line: 0.125rem; + + /* The start page's neutrals for inactive cards; text contrast about 5.5:1 (light) and 6.5:1 (dark). */ + --event-card-inactive-bg: light-dark(#c9dabf, #162915); + --event-card-inactive-line: light-dark(#b2c4aa, #2d3f2a); + --event-card-inactive-text: light-dark(#435540, #9cae94); + + display: grid; + grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); + gap: 2rem; + margin-block: 0 var(--spacing-m); + padding: 0; + list-style: none; +} + +.event-cards__item { + max-width: none; +} + +.event-card { + display: flex; + flex-direction: column; + block-size: 100%; + border: var(--event-card-line) solid var(--c40-green); + background: var(--color-body-bg); + color: var(--color-text); + text-decoration: none; +} + +.event-card__heading { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 0.5rem 1rem; + border-block-end: var(--event-card-line) solid var(--c40-green); + color: light-dark(var(--c40-light-fg), var(--c40-green)); +} + +.event-card__title { + max-width: none; + margin: 0; + color: inherit; + font-family: var(--ff-display); + font-size: calc(var(--fs-l) * var(--display-scale)); + font-weight: 400; + line-height: 1; + text-decoration: none; +} + +/* The logo as a mask in the text colour, 2rem high (the start page's size-8 icons); wide + wordmarks shrink to leave room for the title. */ +.event-card__logo { + flex: none; + max-inline-size: 60%; + block-size: 2rem; + background-color: currentcolor; + mask: var(--event-logo) right center / contain no-repeat; +} + +.event-card__body { + display: flex; + flex-direction: column; + flex-grow: 1; + gap: 0.25rem; + padding: 0.5rem 1rem 0.75rem; + + p { + margin: 0; + } +} + +.event-card__motto { + font-weight: bold; +} + +.event-card__meta { + color: var(--color-text-meta); + font-size: var(--fs-s); +} + +.event-card__status { + align-self: flex-start; + margin-block-start: 0.25rem; + padding: 0.1rem 0.5rem; + border: var(--event-card-line) solid currentcolor; + font-size: var(--fs-xs); + font-weight: bold; + letter-spacing: 0.03em; + text-transform: uppercase; +} + +.event-card--inactive { + border-color: var(--event-card-inactive-line); + background: var(--event-card-inactive-bg); + color: var(--event-card-inactive-text); + + .event-card__heading { + border-color: var(--event-card-inactive-line); + color: inherit; + } + + .event-card__meta { + color: inherit; + } +} + +/* Hover and focus: the heading bar is filled, ink in the light scheme and green in the dark one, + and the text below is underlined like a link. */ +a.event-card:hover, +a.event-card:focus-visible { + border-color: light-dark(var(--c40-ink), var(--c40-green)); + background: var(--color-body-bg); + + .event-card__heading { + border-color: light-dark(var(--c40-ink), var(--c40-green)); + background: light-dark(var(--c40-ink), var(--c40-green)); + color: light-dark(var(--c40-green), var(--c40-ink)); + } + + .event-card__body { + text-decoration: underline; + } +} + +.event-cards__credits { + color: var(--color-text-meta); + font-size: var(--fs-xs); +} + +/* Forced colours drop background colours, and with them the masked logos. */ +@media (forced-colors: active) { + .event-card__logo { + background-color: CanvasText; + forced-color-adjust: none; + } + + a.event-card .event-card__logo { + background-color: LinkText; + } +} diff --git a/assets/img/events/37c3.svg b/assets/img/events/37c3.svg new file mode 100644 index 0000000..926f429 --- /dev/null +++ b/assets/img/events/37c3.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/img/events/38c3.svg b/assets/img/events/38c3.svg new file mode 100644 index 0000000..505dbeb --- /dev/null +++ b/assets/img/events/38c3.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/img/events/39c3.svg b/assets/img/events/39c3.svg new file mode 100644 index 0000000..19fddb9 --- /dev/null +++ b/assets/img/events/39c3.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/assets/img/events/40c3.svg b/assets/img/events/40c3.svg new file mode 100644 index 0000000..9146ede --- /dev/null +++ b/assets/img/events/40c3.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/img/events/Sources.txt b/assets/img/events/Sources.txt new file mode 100644 index 0000000..bf3fbb7 --- /dev/null +++ b/assets/img/events/Sources.txt @@ -0,0 +1,18 @@ +Event logos for the event cards on the home page (events shortcode, data/events.yaml). +The cards use them as masks in the text colour, so the colours in the files don't matter. +All files are unmodified copies of the originals. + +37c3.svg https://designs.events.ccc.de/37C3/37c3-logo-full-black.svg +38c3.svg https://designs.events.ccc.de/38C3/logo-simple.svg +39c3.svg https://designs.events.ccc.de/39C3/39C3-Logo-RGB_muted-black.svg + From the CCC event design archive, https://designs.events.ccc.de/ + +40c3.svg https://events.ccc.de/congress/2026/infos/assets/favicon.svg + The 40C3 symbol from the 40C3 info pages; the design archive has no 40C3 entry yet. + +eh22.svg logo/logo_simple.svg from the Easterhegg 2025 design repository, + https://git.hamburg.ccc.de/EH22/design-public + By kritzl, traumweh & Schrottkatze, licensed under CC BY-SA 4.0, + https://creativecommons.org/licenses/by-sa/4.0/ + The home page credits it below the cards (credit in data/events.yaml). + The design archive's EH22 logo is a raster image with a glow, which doesn't work as a mask. diff --git a/assets/img/events/eh22.svg b/assets/img/events/eh22.svg new file mode 100644 index 0000000..0ab3f5d --- /dev/null +++ b/assets/img/events/eh22.svg @@ -0,0 +1,34 @@ + + + + + + + + + + diff --git a/content/de/_index.md b/content/de/_index.md index 378f538..dd0b01a 100644 --- a/content/de/_index.md +++ b/content/de/_index.md @@ -20,6 +20,8 @@ Wir bereiten Touren für den [40C3](https://events.ccc.de/category/40c3/) vor. I ![Hamburger Hacker Ausflüge am CCC. CC0 Amzi](hackertours_banner.webp) -Frühere Veranstaltungen: [37C3](37c3) / [38C3](38c3) / [EH22](eh22) / [39C3](39c3) +## Veranstaltungen + +{{< events >}} ## News diff --git a/content/en/_index.md b/content/en/_index.md index 407411f..e61a3e7 100644 --- a/content/en/_index.md +++ b/content/en/_index.md @@ -20,7 +20,9 @@ We are preparing tours for [40C3](https://events.ccc.de/category/40c3/). Stay tu ![Hamburger Hacker Ausflüge am CCC. CC0 Amzi](hackertours_banner.webp) -Previous events: [37C3](37c3) / [38C3](38c3) / [EH22](eh22) / [39C3](39c3) +## Events + +{{< events >}} ## News \ No newline at end of file diff --git a/data/events.yaml b/data/events.yaml new file mode 100644 index 0000000..9579788 --- /dev/null +++ b/data/events.yaml @@ -0,0 +1,36 @@ +# Event cards on the home page, rendered by the events shortcode, newest first. +# event: the event's section (content/*//) and logo (assets/img/events/.svg). +# status: inprogress greys out the card and leaves out the link, for an event without tours yet. +events: + - event: 40c3 + title: { de: 40. Chaos Communication Congress, en: 40th Chaos Communication Congress } + motto: Model Citizens + start: "2026-12-27" + end: "2026-12-30" + venue: Hamburg Messe + status: inprogress + - event: 39c3 + title: { de: 39. Chaos Communication Congress, en: 39th Chaos Communication Congress } + motto: Power Cycles + start: "2025-12-27" + end: "2025-12-30" + venue: CCH + - event: eh22 + title: Easterhegg 2025 + motto: Unhandled Eggception + start: "2025-04-18" + end: "2025-04-21" + venue: Kampnagel + credit: "[kritzl, traumweh & Schrottkatze](https://git.hamburg.ccc.de/EH22/design-public), [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)" + - event: 38c3 + title: { de: 38. Chaos Communication Congress, en: 38th Chaos Communication Congress } + motto: Illegal Instructions + start: "2024-12-27" + end: "2024-12-30" + venue: CCH + - event: 37c3 + title: { de: 37. Chaos Communication Congress, en: 37th Chaos Communication Congress } + motto: Unlocked + start: "2023-12-27" + end: "2023-12-30" + venue: CCH diff --git a/i18n/de.yaml b/i18n/de.yaml index 0a49b28..2dc6216 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -9,3 +9,8 @@ gallery_dialog: "Bildansicht" gallery_close: "Schließen" gallery_previous: "Vorheriges Bild" gallery_next: "Nächstes Bild" +events_inprogress: "In Vorbereitung" +events_logo: "Logo {{ .Name }}" +events_date: "2. January 2006" +events_date_day_month: "2. January" +events_date_day: "2." diff --git a/i18n/en.yaml b/i18n/en.yaml index 8929d38..0dc05ec 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -9,3 +9,8 @@ gallery_dialog: "Image viewer" gallery_close: "Close" gallery_previous: "Previous image" gallery_next: "Next image" +events_inprogress: "In progress" +events_logo: "{{ .Name }} logo" +events_date: "2 January 2006" +events_date_day_month: "2 January" +events_date_day: "2" diff --git a/layouts/_shortcodes/events.html b/layouts/_shortcodes/events.html new file mode 100644 index 0000000..c5e93a4 --- /dev/null +++ b/layouts/_shortcodes/events.html @@ -0,0 +1,82 @@ +{{- /* +Event cards from data/events.yaml, after the cards on the 40C3 start page +(events.ccc.de/congress/2026/infos/startpage.html): the event's name and logo +(assets/img/events/.svg) in a heading bar, its motto, full name, dates and venue below. +Cards link to the event's section; an event that is in progress, or has no section, gets a +greyed-out card without a link. Logo credits from the data file follow the cards. + +Usage: {{< events >}} +*/ -}} +{{- $events := slice -}} +{{- with hugo.Data.events }}{{ with .events }}{{ $events = . }}{{ end }}{{ end -}} +{{- if not $events -}} + {{- warnidf "warning-events-empty" "events: no events in data/events.yaml: %s" .Position -}} +{{- else -}} +{{- $credits := slice -}} +
    +{{- range $events }} +{{- $name := .name | default (upper .event) }} +{{- $inProgress := eq .status "inprogress" }} +{{- $page := site.GetPage (printf "/%s" .event) }} +{{- if not (or $page $inProgress) }}{{ warnf "events: no section page for event %q" .event }}{{ end }} +{{- $link := and $page (not $inProgress) }} +{{- /* A title with one entry per language, or one for all. */}} +{{- $title := .title }} +{{- if reflect.IsMap $title }}{{ $title = index $title site.Language.Name | default (index $title "en") }}{{ end }} +{{- /* Date ranges as on the 40C3 start page: "27.–30. Dezember 2026", "27–30 December 2026". */}} +{{- $start := time.AsTime .start }} +{{- $end := time.AsTime (.end | default .start) }} +{{- $date := i18n "events_date" }} +{{- $when := $end | time.Format $date }} +{{- if ne $start.Year $end.Year }} + {{- $when = printf "%s – %s" ($start | time.Format $date) $when }} +{{- else if ne $start.Month $end.Month }} + {{- $when = printf "%s – %s" ($start | time.Format (i18n "events_date_day_month")) $when }} +{{- else if ne $start.Day $end.Day }} + {{- $when = printf "%s–%s" ($start | time.Format (i18n "events_date_day")) $when }} +{{- end }} +{{- /* The logo keeps its proportions (the SVG's viewBox) at the height set in CSS. */}} +{{- $logo := resources.Get (printf "img/events/%s.svg" .event) }} +{{- $ratio := slice 1 1 }} +{{- with $logo }} + {{- with findRESubmatch `viewBox="\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)\s*"` .Content 1 }} + {{- $ratio = slice (float (index . 0 1)) (float (index . 0 2)) }} + {{- end }} +{{- else }} + {{- warnf "events: no logo assets/img/events/%s.svg" .event }} +{{- end }} +{{- with .credit }}{{ $credits = $credits | append (dict "name" $name "credit" .) }}{{ end }} +
  • +{{- if $link }} + +{{- else }} +{{ end }} +
  • +{{- end }} +
+{{- with $credits }} +

+{{- range $index, $entry := . }}{{ if $index }} · {{ end }}{{ i18n "events_logo" (dict "Name" $entry.name) }}: {{ $.Page.RenderString $entry.credit }}{{ end -}} +

+{{- end }} +{{- end }}