mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 02:14:21 +00:00
feat: add support for multi-day events
Previously, the talk layout was intended for talks (intra-day events). This commit adds support for more general events which can span multiple days. Close #1169
This commit is contained in:
1 parent
c8832e3881
commit
03599c42d5
5 files changed
+21
-34
No files matched your search
@@ -0,0 +1,17 @@
|
||||
{{/* Function to get event start and end dates/times. */}}
|
||||
{{ $t1 := time .Date }}{{/* Start datetime. */}}
|
||||
{{ $str := slice ((time $t1).Format site.Params.date_format) }}{{/* Init return string with start date. */}}
|
||||
{{/* Show start time if not all day event. */}}
|
||||
{{ if not .Params.all_day }}{{ $str = $str | append ((time $t1).Format (site.Params.time_format)) }}{{ end }}
|
||||
{{/* Show event end date if provided. */}}
|
||||
{{ if .Params.date_end }}
|
||||
{{ $str = $str | append "—" }}
|
||||
{{ $t2 := time .Params.date_end}}{{/* End datetime. */}}
|
||||
{{/* Show end date if it differs to start date. */}}
|
||||
{{ if not (eq $t1.Year $t2.Year | and (eq $t1.Month $t2.Month) | and (eq $t1.Day $t2.Day)) }}
|
||||
{{ $str = $str | append ((time $t2).Format site.Params.date_format) }}
|
||||
{{ end }}
|
||||
{{/* Show end time if not all day event. */}}
|
||||
{{ if not .Params.all_day }}{{ $str = $str | append ((time $t2).Format (site.Params.time_format)) }}{{ end }}
|
||||
{{ end }}
|
||||
{{ return (delimit $str " ") }}
|
||||
@@ -36,14 +36,7 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
<span itemprop="startDate">
|
||||
{{ $date := $item.Date }}
|
||||
{{ (time $date).Format site.Params.date_format }}
|
||||
{{ if not $item.Params.all_day }}
|
||||
{{ (time $date).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ with $item.Params.date_end }}
|
||||
— {{ (time .).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ partial "functions/get_event_dates" $item }}
|
||||
</span>
|
||||
{{ with $item.Params.location }}
|
||||
<span class="middot-divider"></span>
|
||||
|
||||
@@ -45,14 +45,7 @@
|
||||
{{ if eq $item.Type "talk" }}
|
||||
<div>
|
||||
<span itemprop="startDate">
|
||||
{{ $date := $item.Date }}
|
||||
{{ (time $date).Format site.Params.date_format }}
|
||||
{{ if not $item.Params.all_day }}
|
||||
{{ (time $date).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ with $item.Params.date_end }}
|
||||
— {{ (time .).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ partial "functions/get_event_dates" $item }}
|
||||
</span>
|
||||
{{ with $item.Params.location }}
|
||||
<span class="middot-divider"></span>
|
||||
|
||||
@@ -25,14 +25,7 @@
|
||||
{{ if eq $item.Type "talk" }}
|
||||
<div class="article-metadata">
|
||||
<span itemprop="startDate">
|
||||
{{ $date := $item.Date }}
|
||||
{{ (time $date).Format site.Params.date_format }}
|
||||
{{ if not $item.Params.all_day }}
|
||||
{{ (time $date).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ with $item.Params.date_end }}
|
||||
— {{ (time .).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ partial "functions/get_event_dates" $item }}
|
||||
</span>
|
||||
{{ with $item.Params.location }}
|
||||
<span class="middot-divider"></span>
|
||||
|
||||
@@ -19,16 +19,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-3 pub-row-heading">{{ i18n "date" }}</div>
|
||||
<div class="col-12 col-md-9" itemprop="datePublished">
|
||||
{{ $date := .Date }}
|
||||
{{ (time $date).Format site.Params.date_format }}
|
||||
<div class="talk-time">
|
||||
{{ if not .Params.all_day }}
|
||||
{{ (time $date).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ with .Params.date_end }}
|
||||
— {{ (time .).Format (site.Params.time_format | default "3:04 PM") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ partial "functions/get_event_dates" . }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user