From 934bf9d9f4742fcaaed2edc881acf664f19c5469 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Sat, 14 Nov 2026 21:14:59 +0100 Subject: [PATCH] Add book shortcode for booking a tour date --- README.md | 14 ++++++++++++++ themes/hackertours/assets/css/_custom.css | 11 +++++++++++ themes/hackertours/i18n/de.yaml | 1 + themes/hackertours/i18n/en.yaml | 1 + themes/hackertours/layouts/_shortcodes/book.html | 14 ++++++++++++++ 5 files changed, 41 insertions(+) create mode 100644 themes/hackertours/layouts/_shortcodes/book.html diff --git a/README.md b/README.md index ad41192..67995ec 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,20 @@ The icon is `regular/calendar-plus` from [Font Awesome Free](https://fontawesome Each entry starts at the time given, in Hamburg time, at the Hackertours desk (with `map.origin` from the schedule file as the address, if there is one). Its description is the tour summary and a link to the tour page. The files are generated next to the tour page, one per date and language, e.g. `/de/40c3/tour-of-the-giants/tour-of-the-giants-2026-12-27-1730.ics`. +## 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: + +```markdown +* Tag 1 (27.12.) **13:00 Uhr** {{< book url="https://…/hackertours/40c3ht/100/" >}} {{< calendar date="2026-12-27" time="13:00" >}} +``` + +| Param | Required | Content | +|---|---|---| +| `url` | yes | The date in the ticket shop | + +The button text is `book_now` in the theme's i18n files. The icon is `solid/cart-shopping` from Font Awesome Free (see "Shortcode: Calendar entry"). + ## Shortcode: Tour map `{{< tour-map >}}` on an event's overview page shows a map of the tour locations, with the routes from the Congress, on OpenStreetMap. For a different event than the page's section, pass its name: `{{< tour-map 39c3 >}}`. It uses [Leaflet](https://leafletjs.com), which is kept in [themes/hackertours/assets/vendor/leaflet/](themes/hackertours/assets/vendor/leaflet/). diff --git a/themes/hackertours/assets/css/_custom.css b/themes/hackertours/assets/css/_custom.css index 591ac76..6ed2fbd 100644 --- a/themes/hackertours/assets/css/_custom.css +++ b/themes/hackertours/assets/css/_custom.css @@ -264,6 +264,17 @@ span.content-image { color: var(--color-text-meta); } +/* Booking button after a tour date, see layouts/_shortcodes/book.html. */ +.tour-book { + display: inline-flex; + align-items: center; + gap: 0.4em; + min-height: 24px; + margin-inline-start: 0.4em; + vertical-align: middle; + white-space: nowrap; +} + .fa-icon { width: 1em; height: 1em; diff --git a/themes/hackertours/i18n/de.yaml b/themes/hackertours/i18n/de.yaml index 7ffe888..ad41250 100644 --- a/themes/hackertours/i18n/de.yaml +++ b/themes/hackertours/i18n/de.yaml @@ -1,3 +1,4 @@ +book_now: "Jetzt buchen" calendar_meeting_point: "Hackertours-Desk" calendar_ics: "iCal Download" calendar_google: "Google Calendar" diff --git a/themes/hackertours/i18n/en.yaml b/themes/hackertours/i18n/en.yaml index 8323ca6..db6db3c 100644 --- a/themes/hackertours/i18n/en.yaml +++ b/themes/hackertours/i18n/en.yaml @@ -1,3 +1,4 @@ +book_now: "Book now" calendar_ics: "iCal download" calendar_google: "Google calendar" calendar_meeting_point: "Hackertours Desk" diff --git a/themes/hackertours/layouts/_shortcodes/book.html b/themes/hackertours/layouts/_shortcodes/book.html new file mode 100644 index 0000000..1e10a9a --- /dev/null +++ b/themes/hackertours/layouts/_shortcodes/book.html @@ -0,0 +1,14 @@ +{{- /* +A button that books one date of a tour in the ticket shop, with a shopping cart icon. Meant +for the list of dates on a tour page, before the calendar links: + + * Tag 1 (27.12.) **17:30 Uhr** {{< book url="https://…/" >}} {{< calendar … >}} + +Param: url, the date in the ticket shop. +*/ -}} +{{- $url := .Get "url" -}} +{{- if not $url }}{{ errorf "book: no url: %s" .Position }}{{ end -}} + + {{- partial "fa-icon.html" "solid/cart-shopping" }}{{ i18n "book_now" -}} + +{{- /* chomp */ -}} -- 2.54.0