Skip to content

Commit db9f1d1

Browse files
author
Zyna
committed
fix: handle null venue
1 parent 2787f81 commit db9f1d1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

content/post/_content.gotmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
{{ $image := $template.image.data.attributes }}
2121

2222
{{/* Use {timeDescription} | {presenceMode} @ {venueName} for subtitle. */}}
23-
{{ $venueName := .attributes.venue.data.attributes.name }}
2423
{{ $presenceMode := .attributes.presenceMode }}
2524
{{ $timeDescription := .attributes.timeDescription }}
2625

2726
{{ $subtitle := "" }}
28-
{{ if or (eq $presenceMode "offline") (eq $presenceMode "hybrid") }}
27+
{{ if and .attributes.venue (or (eq $presenceMode "offline") (eq $presenceMode "hybrid")) }}
28+
{{ $venueName := .attributes.venue.data.attributes.name }}
2929
{{ $subtitle = printf "%s | %s @ %s" $timeDescription $presenceMode $venueName }}
3030
{{ else }}
3131
{{ $subtitle = printf "%s | %s" $timeDescription $presenceMode }}

themes/beautifulhugo/layouts/partials/post_content.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
{{/* Define variables for each attribute */}}
55
{{ $shortDescription := $template.shortDescription }}
6-
{{ $venueDescription := .attributes.venue.data.attributes.description }}
76
{{ $presenceMode := .attributes.presenceMode }}
87

98
{{/* Create bullet points for requirements */}}
@@ -33,8 +32,9 @@
3332

3433

3534
{{ $eventDetailsSection := printf "## Event Details\n%s" $eventDetails }}
36-
{{ if ne $presenceMode "online" }}
37-
{{ $eventDetailsSection = printf "## Event Details\n%s\n\n### Venue\n%s" $eventDetails $venueDescription }}
35+
{{ if and .attributes.venue (ne $presenceMode "online") }}
36+
{{ $venueDescription := .attributes.venue.data.attributes.description }}
37+
{{ $eventDetailsSection = printf "## Event Details\n%s\n\n### Venue\n%s" $eventDetails $venueDescription }}
3838
{{ end }}
3939

4040

0 commit comments

Comments
 (0)