diff --git a/README.md b/README.md index 724bc9c..5ec6083 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,6 @@ days: - `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. -- With the day picker, the first local photo in the tour page is shown on its card when it has alt text; its gallery credit is displayed below it. For the events managed with Hackertours-Admin, the data file is generated by its website sync; don't edit it by hand. diff --git a/themes/hackertours/assets/css/_schedule.css b/themes/hackertours/assets/css/_schedule.css index 60d4992..d752402 100644 --- a/themes/hackertours/assets/css/_schedule.css +++ b/themes/hackertours/assets/css/_schedule.css @@ -133,34 +133,6 @@ gap: 0 0.5rem; } -.schedule--picker .schedule__card--photo { - grid-template-columns: minmax(0, 1fr) auto minmax(0, 6rem); - - .schedule__title { - grid-column: 1 / 3; - } -} - -.schedule__photo { - display: none; - grid-column: 3; - grid-row: 1 / 3; - margin: 0; - font-size: var(--fs-xs); - color: var(--color-text-meta); - overflow-wrap: anywhere; - - img { - display: block; - width: 100%; - height: auto; - } -} - -.schedule--picker .schedule__photo { - display: block; -} - .schedule__status { font-family: var(--ff-alt); font-size: var(--fs-xs); diff --git a/themes/hackertours/layouts/_partials/first-page-image.html b/themes/hackertours/layouts/_partials/first-page-image.html deleted file mode 100644 index 5225aa8..0000000 --- a/themes/hackertours/layouts/_partials/first-page-image.html +++ /dev/null @@ -1,19 +0,0 @@ -{{- $result := dict -}} -{{- with findRESubmatch `!\[([^\]]*)\]\(\s*([^\s)>]+)|\{\{<\s*gallery-image\s([^}]*)>\}\}` .RawContent 1 -}} - {{- $alt := index . 0 1 -}} - {{- $dest := index . 0 2 -}} - {{- $credit := "" -}} - {{- with index . 0 3 -}} - {{- $dest = "" -}} - {{- $alt = "" -}} - {{- with findRESubmatch "\\bsrc=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $dest = or (index . 0 1) (index . 0 2) }}{{ end -}} - {{- with findRESubmatch "\\balt=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $alt = or (index . 0 1) (index . 0 2) }}{{ end -}} - {{- with findRESubmatch "\\bcredit=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $credit = or (index . 0 1) (index . 0 2) }}{{ end -}} - {{- end -}} - {{- $resource := false -}} - {{- if not (findRE `^https?://` $dest) -}} - {{- $resource = or ($.Resources.Get (strings.TrimPrefix "./" $dest)) (resources.Get $dest) -}} - {{- end -}} - {{- $result = dict "alt" $alt "credit" $credit "dest" $dest "resource" $resource -}} -{{- end -}} -{{- return $result -}} diff --git a/themes/hackertours/layouts/_partials/head/extra.html b/themes/hackertours/layouts/_partials/head/extra.html index 6bedff0..74fd6b7 100644 --- a/themes/hackertours/layouts/_partials/head/extra.html +++ b/themes/hackertours/layouts/_partials/head/extra.html @@ -6,15 +6,24 @@ gallery-image shortcode, scaled down to at most 1200 pixels wide, with its alt t og:image:alt. */ -}} {{- if not ($.Param "image") -}} - {{- with partialCached "first-page-image.html" . .RelPermalink -}} - {{- $alt := .alt -}} - {{- $dest := .dest -}} + {{- /* Whichever comes first: a Markdown image or a gallery-image shortcode (src and alt in "…" or `…`). */ -}} + {{- with findRESubmatch `!\[([^\]]*)\]\(\s*([^\s)>]+)|\{\{<\s*gallery-image\s([^}]*)>\}\}` .RawContent 1 -}} + {{- $alt := index . 0 1 -}} + {{- $dest := index . 0 2 -}} + {{- with index . 0 3 -}} + {{- $dest = "" -}} + {{- $alt = "" -}} + {{- with findRESubmatch "\\bsrc=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $dest = or (index . 0 1) (index . 0 2) }}{{ end -}} + {{- with findRESubmatch "\\balt=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $alt = or (index . 0 1) (index . 0 2) }}{{ end -}} + {{- end -}} {{- $url := "" -}} {{- $width := 0 -}} {{- $height := 0 -}} - {{- $resource := .resource -}} + {{- $resource := false -}} {{- if findRE `^https?://` $dest -}} {{- $url = $dest -}} + {{- else -}} + {{- $resource = or ($.Resources.Get (strings.TrimPrefix "./" $dest)) (resources.Get $dest) -}} {{- end -}} {{- with $resource -}} {{- $image := . -}} diff --git a/themes/hackertours/layouts/_shortcodes/schedule.html b/themes/hackertours/layouts/_shortcodes/schedule.html index 09200c1..fb933b5 100644 --- a/themes/hackertours/layouts/_shortcodes/schedule.html +++ b/themes/hackertours/layouts/_shortcodes/schedule.html @@ -81,23 +81,7 @@ so an hour without tours still gets a row. {{- /* A tour's own title, in the page's language, replaces its page's title. */}} {{- $ownTitle := "" }} {{- with .title }}{{ $ownTitle = index . site.Language.Name | default (index . "en") }}{{ end }} -{{- $photo := false }} -{{- $photoAlt := "" }} -{{- $photoCredit := "" }} -{{- with $page }} - {{- with partialCached "first-page-image.html" . .RelPermalink }} - {{- if and .resource .alt }} - {{- if and (eq .resource.ResourceType "image") (ne .resource.MediaType.SubType "svg") }} - {{- $oriented := .resource.Filter images.AutoOrient }} - {{- $side := math.Min 240 $oriented.Width $oriented.Height | int }} - {{- $photo = $oriented.Fill (printf "%dx%d Smart" $side $side) }} - {{- $photoAlt = .alt }} - {{- $photoCredit = .credit }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} -