Tour pages: tour-date and fewseats shortcodes; one few-seats mark per card
All checks were successful
/ build (push) Successful in 1m53s
/ accessibility (push) Successful in 3m52s

tour-date formats one date in a tour page's list of dates from its
parameters: day and date, time, title, language, note, status (soldout,
fewseats), "Book now" button and calendar links. Hackertours-Admin can
write it instead of the formatted text. fewseats shows the badge for the
tour as a whole from params.fewseats, unless a date on the page already
says so. book and calendar keep working; their HTML moved to partials.

In the schedule, the tour badge is left out on dates with a status of
their own, so a card no longer says "few seats left" twice.
This commit is contained in:
Stefan Bethke 2026-11-16 10:23:15 +01:00
commit 47c4008dd4

View file

@ -101,11 +101,12 @@ Use the `lang` shortcode to mark whether a tour is in German, English or bilingu
The tour overview of an event (`content/*/<event>/_index.md`) shows the schedule with `{{< schedule >}}`. It reads `data/schedule/<event>.yaml`, which is shared by both languages:
```yaml
fewseats: [xfel]
days:
- day: 1
date: "2025-12-27"
tours:
- { time: "11:30", tour: xfel, lang: deen }
- { time: "11:30", tour: xfel, lang: deen, status: fewseats }
- { time: "12:00", tour: city-walk, lang: de }
```
@ -113,7 +114,8 @@ days:
- `lang` is `de`, `en` or `deen`, or a list of these. It renders the same badge as the `lang` shortcode.
- `time` is `HH:MM` with a leading zero (`09:30`). Tours are sorted by time, so their order in the file doesn't matter.
- `title` (optional) replaces the page's title on the card, with one entry per language: `title: { de: "Hafen am Abend", en: "Harbour by Night" }`.
- `status` (optional): `soldout` marks the tour as fully booked. Other values are ignored.
- `status` (optional): `soldout` marks the date as fully booked; `fewseats` highlights "Nur wenige Plätze über" / "only a few seats left" next to the time, for a date on sale with 5 seats or fewer. Other values are ignored.
- `fewseats` (optional, top level): slugs of the tours with only a few seats left as a whole. Their cards get a small "only a few seats left" badge below the title, except on dates that have a `status` of their own, so a card never says it twice. A date can be `fewseats` without its tour being in the list, and the other way round.
- With JavaScript at viewport widths of at least 667px, the first local photo in the tour page fills the right 40% of its card behind a fade when it has alt text; its gallery credit remains visible.
For the events managed with Hackertours-Admin, the data file is generated by its website sync; don't edit it by hand.
@ -123,9 +125,53 @@ With JavaScript, narrow screens show a day picker, starting with today's day dur
For a different event than the page's section, pass its name: `{{< schedule 39c3 >}}`.
Without a data file, or without any tours in it, the shortcode renders nothing and the build logs a warning. To silence it, for example for an upcoming event, add `warning-schedule-empty` to `ignoreLogs` in `hugo.yaml`.
## Shortcode: Tour date
`{{< tour-date >}}` is one date in the list of dates on a tour page. Hackertours-Admin writes the facts as parameters, and the shortcode formats them the same way on every page: day and date, time, the date's own title, language, a note, and on a new line the "only a few seats left" note, the "Book now" button and the calendar links. Use it inside a list item:
```markdown
* Touren:
* {{< tour-date day=1 date="2026-12-27" time="13:30" lang="de" title=`Piraten!?` book=`https://…/40c3ht/229/` duration=180 >}}
* {{< tour-date day=2 date="2026-12-28" time="12:55" lang="deen" note=`Die Tour wird auf Deutsch präsentiert, …` book=`https://…/40c3ht/227/` status="fewseats" >}}
```
renders (on the German page)
> * Touren:
> * Tag 1 (27.12.) **13:30 Uhr** *Piraten!?* auf Deutsch\
> [Jetzt buchen] [iCal Download | Google Calendar]
> * Tag 2 (28.12.) **12:55 Uhr** auf Deutsch und Englisch – Die Tour wird auf Deutsch präsentiert, …\
> Nur wenige Plätze über [Jetzt buchen] [iCal Download | Google Calendar]
| Param | Required | Content |
|---|---|---|
| `date` | yes | `YYYY-MM-DD` |
| `time` | yes | Start time `HH:MM`, local time in Hamburg |
| `day` | no | Day number of the event (`0` for the day before day 1). Shown as "Tag 1 (27.12.)" / "Day 1 (27 December)". Leave it out for dates grouped under a day heading, as in `* Tag 1 (27.12.):` followed by the times. |
| `lang` | no | `de`, `en` or `deen`: "auf Deutsch", "auf Englisch", "auf Deutsch und Englisch" / "in German", "in English", "in German and English". Anything else stops the build. |
| `title` | no | The date's own title, in italics after the time, in the page's language. |
| `note` | no | Text after the language, after a dash, in the page's language. Markdown is allowed. |
| `book` | no | The date in the ticket shop, for the "Book now" button. |
| `duration` | no | Length in minutes, for the calendar entry (see "Shortcode: Calendar entry"). |
| `status` | no | `soldout` strikes the date through and adds "ausgebucht" / "fully booked", without the button and the calendar links. `fewseats` adds the highlighted "Nur wenige Plätze über" / "only a few seats left" before the button. Other values are ignored, as in the schedule. |
Use backticks around values that contain double quotes. The wording is in the theme's i18n files (`tour_date_*`, `fewseats`, `schedule_soldout`).
## Shortcode: Few seats left
`{{< fewseats >}}` says "Nur wenige Plätze über" / "only a few seats left" for the tour as a whole, as a small badge, when the page's front matter has
```yaml
params:
fewseats: true
```
Hackertours-Admin puts it on its own line, right before the list of dates. It shows nothing without `params.fewseats: true`, and nothing when a date on the page already says so (a `tour-date` with `status="fewseats"`), so the page doesn't say it twice. The tour lists (the event's overview page, the home page, the tour-map's list of locations) show the same badge from `params.fewseats`, without the shortcode.
## Shortcode: Calendar entry
`{{< calendar >}}` adds a small pill after a tour date with a calendar icon and two links: "iCal download", a calendar file (`.ics`) for that date, and "Google calendar", which adds the date in Google Calendar. Hackertours-Admin puts it into the list of dates on each tour page:
`{{< calendar >}}` adds a small pill after a tour date with a calendar icon and two links: "iCal download", a calendar file (`.ics`) for that date, and "Google calendar", which adds the date in Google Calendar. `tour-date` includes it; for a hand-written list of dates, use it on its own:
```markdown
* Tag 1 (27.12.) **17:30 Uhr** {{< calendar date="2026-12-27" time="17:30" duration="210" >}}
@ -146,7 +192,7 @@ Each entry starts at the time given, in Hamburg time, at the Hackertours desk (w
## Shortcode: Book now
`{{< book >}}` adds a "Book now" button with a shopping cart icon after a tour date, linking to that date in the ticket shop. Hackertours-Admin puts it into the list of dates on each tour page, before the calendar pill:
`{{< book >}}` adds a "Book now" button with a shopping cart icon after a tour date, linking to that date in the ticket shop. `tour-date` includes it; for a hand-written list of dates, use it on its own, before the calendar pill:
```markdown
* Tag 1 (27.12.) **13:00 Uhr** {{< book url="https://…/hackertours/40c3ht/100/" >}} {{< calendar date="2026-12-27" time="13:00" >}}