Merge remote-tracking branch 'origin/main' into 40c3

# Conflicts:
#	i18n/de.yaml
#	i18n/en.yaml
This commit is contained in:
Stefan Bethke 2026-11-14 00:24:43 +01:00
commit ab48ebcf58
2 changed files with 393 additions and 2 deletions

View file

@ -0,0 +1,13 @@
{{- /* Overrides the zen theme's footer.html: the theme's footer, plus the credits for event logos
whose licence asks for one (credit in data/events.yaml), on pages that show the event cards. */ -}}
{{ if $.Param "feedlinks" }}{{ partial "feedlinks.html" . }}{{ end -}}
<p>{{ with site.Copyright }}{{ . | site.Home.RenderString }}{{ else }}<span>© {{ site.Title }}</span>{{ end }}</p>
{{- if .HasShortcode "events" }}
{{- $credits := slice }}
{{- with hugo.Data.events }}{{ range .events }}{{ if .credit }}{{ $credits = $credits | append (dict "name" (.name | default (upper .event)) "credit" .credit) }}{{ end }}{{ end }}{{ end }}
{{- with $credits }}
<p>{{ range $index, $entry := . }}{{ if $index }} · {{ end }}{{ i18n "events_logo" (dict "Name" $entry.name) }}: {{ $entry.credit | site.Home.RenderString }}{{ end }}</p>
{{- end }}
{{- end }}
{{ with $.Param "footer" }}<p>{{ . | site.Home.RenderString }}</p>{{ end }}
{{ if $.Param "poweredby" }}<p>Powered by <a href="https://gohugo.io/">Hugo</a> and the <a href="https://github.com/frjo/hugo-theme-zen">Zen theme</a>.</p>{{ end }}

View file

@ -0,0 +1,75 @@
{{- /*
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/<event>.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 appear in the page footer.
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 -}}
<ul class="event-cards" role="list">
{{- 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 }}
<li class="event-cards__item">
{{- if $link }}
<a class="event-card" href="{{ $page.RelPermalink }}">
{{- else }}
<div class="event-card event-card--inactive">
{{- end }}
<div class="event-card__heading">
<h3 class="event-card__title">{{ $name }}</h3>
{{- with $logo }}
<span class="event-card__logo" style="--event-logo: url({{ .RelPermalink }}); aspect-ratio: {{ index $ratio 0 }} / {{ index $ratio 1 }}" aria-hidden="true"></span>
{{- end }}
</div>
<div class="event-card__body">
{{- with .motto }}
<p class="event-card__motto">{{ . }}</p>
{{- end }}
{{- with $title }}
<p class="event-card__meta">{{ . }}</p>
{{- end }}
<p class="event-card__meta">{{ $when }}{{ with .venue }}, {{ . }}{{ end }}</p>
{{- if $inProgress }}
<p class="event-card__status">{{ i18n "events_inprogress" }}</p>
{{- end }}
</div>
{{ if $link }}</a>{{ else }}</div>{{ end }}
</li>
{{- end }}
</ul>
{{- end }}