ccchh-website/themes/ccchh/layouts/shortcodes/calendar-table.html
jtbx d9a1b256ad
All checks were successful
/ build (pull_request) Successful in 37s
/ build (push) Successful in 12s
Calendar: Link to first URL from description
2024-01-23 20:37:19 +01:00

27 lines
740 B
HTML

{{- index .Site.Data "calendar.json" }}
<table>
<thead>
<tr>
<td>Datum</td>
<td>Titel</td>
<td>Ort</td>
</tr>
</thead>
<tbody>
{{- range first 7 (sort $.Site.Data.calendar "dtstart" ) }}
{{- if eq ._type "vevent"}}
<tr>
{{- $start := time .dtstart }}
<td style="font-variant-numeric: tabular-nums;">{{ $start.Local.Format "Mon, 2006-01-02 15:04" }}</td>
{{- $potentialUrl := index (findRE `https?://\S*` .description 1) 0 }}
{{- if eq $potentialUrl nil }}
<td>{{ .summary }}</td>
{{- else }}
<td><a href="{{ $potentialUrl }}">{{ .summary }}</a></td>
{{- end }}
<td>{{ .location }}</td>
</tr>
{{- end }}
{{- end }}
</tbody>
</table>