|
1 | | -{{/* Announcement pop-up for the featured event (DuckDB × MySQL Day). Slides in at |
2 | | - the bottom left of any page after 10 seconds and links to the event page. |
3 | | - Closing it (or clicking through) hides it for the rest of that visit only |
4 | | - (sessionStorage), so it shows again on the next visit. Not rendered on the event |
5 | | - page itself or once the event date has passed. Text comes from the event |
6 | | - page's front matter; timing and dismissal live in the inline script. */}} |
7 | | -{{ $ev := site.GetPage "/events/duckdb-mysql-day" }} |
8 | | -{{ if and $ev (now.Before ($ev.Date.AddDate 0 0 1)) (ne $.RelPermalink $ev.RelPermalink) }} |
9 | | -{{ $cover := $ev.Resources.GetMatch "cover.jpg" }} |
10 | | -<aside class="ev-popup" id="event-popup" hidden aria-label="Event announcement" data-id="duckdb-mysql-day" data-end="{{ $ev.Date.AddDate 0 0 1 | time.Format "2006-01-02T00:00:00Z" }}"> |
| 1 | +{{/* Announcement pop-up. Slides in at the bottom left of any page after 10 |
| 2 | + seconds and links to the announced page. Closing it (or clicking through) |
| 3 | + hides it for the rest of that visit only (sessionStorage), so it shows |
| 4 | + again on the next visit. What it announces comes from data/popups.yaml: |
| 5 | + the first entry that has not ended yet is shown, and never on the page it |
| 6 | + links to. Timing and dismissal live in the inline script. */}} |
| 7 | +{{ $popup := dict }} |
| 8 | +{{ range site.Data.popups }} |
| 9 | + {{ if not $popup }} |
| 10 | + {{ $p := site.GetPage .page }} |
| 11 | + {{ $end := time.AsTime .end }} |
| 12 | + {{ if and $p (now.Before $end) (ne $.RelPermalink $p.RelPermalink) }} |
| 13 | + {{ $popup = merge . (dict "pg" $p "endT" $end) }} |
| 14 | + {{ end }} |
| 15 | + {{ end }} |
| 16 | +{{ end }} |
| 17 | +{{ with $popup }} |
| 18 | +{{ $pg := .pg }} |
| 19 | +{{ $cover := $pg.Resources.GetMatch "cover.jpg" }} |
| 20 | +<aside class="ev-popup" id="event-popup" hidden aria-label="Announcement" data-id="{{ .id }}" data-end="{{ .endT | time.Format "2006-01-02T00:00:00Z" }}"> |
11 | 21 | <button type="button" class="ev-popup-close" aria-label="Close announcement">×</button> |
12 | | - <a href="{{ $ev.RelPermalink }}" class="ev-popup-link"> |
| 22 | + <a href="{{ $pg.RelPermalink }}" class="ev-popup-link"> |
13 | 23 | {{ with $cover }}{{ $img := .Resize "640x q80" }}<img src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}" alt="" class="ev-popup-img" loading="lazy">{{ end }} |
14 | 24 | <span class="ev-popup-body"> |
15 | | - <span class="ev-popup-kicker">{{ $ev.Date.Format "January 2" }} · {{ with $ev.Params.home_meta }}{{ . }}{{ else }}Online{{ end }}</span> |
16 | | - <span class="ev-popup-title">{{ $ev.Title }}</span> |
17 | | - <span class="ev-popup-text">A one-day online conference on fast analytics for MySQL.</span> |
18 | | - <span class="ev-popup-cta">See the speakers & register →</span> |
| 25 | + <span class="ev-popup-kicker">{{ .kicker }}</span> |
| 26 | + <span class="ev-popup-title">{{ .title }}</span> |
| 27 | + <span class="ev-popup-text">{{ .text }}</span> |
| 28 | + <span class="ev-popup-cta">{{ .cta }}</span> |
19 | 29 | </span> |
20 | 30 | </a> |
21 | 31 | </aside> |
|
0 commit comments