From 45b2e054e7c3634cfb09549a3079c913211194bb Mon Sep 17 00:00:00 2001 From: Serge Bibauw Date: Thu, 26 Oct 2017 20:33:02 +0200 Subject: [PATCH] Add `time_format` variable for customizing talk time (#353) * Add `time_format` variable to `config.toml` * Enables customizing talk time between am/pm or 24h format * Correct Go date format URL in documentation --- exampleSite/config.toml | 6 ++++-- layouts/partials/talk_li_detailed.html | 4 ++-- layouts/partials/talk_li_simple.html | 2 +- layouts/talk/single.html | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index b007867d..13d8052f 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -69,9 +69,11 @@ defaultContentLanguageInSubdir = false latitude = "37.4275" longitude = "-122.1697" - # Date format (refer to Go's date format: http://flippinggodateformat.com ) + # Date and time format (refer to Go's date format: http://fuckinggodateformat.com ) # Examples: "Mon, Jan 2, 2006" or "2006-01-02" date_format = "Jan 2, 2006" + # Examples: "3:04 pm" or "15:04" + time_format = "3:04 PM" # Show estimated reading time for posts? reading_time = true @@ -143,7 +145,7 @@ defaultContentLanguageInSubdir = false # Configuration of publication pages. [params.publications] - # Date format (refer to Go's date format: http://flippinggodateformat.com ) + # Date format (refer to Go's date format: http://fuckinggodateformat.com ) # Examples: "Mon, Jan 2, 2006" or "2006-01-02" date_format = "January, 2006" diff --git a/layouts/partials/talk_li_detailed.html b/layouts/partials/talk_li_detailed.html index acda3d6a..02d2bb92 100644 --- a/layouts/partials/talk_li_detailed.html +++ b/layouts/partials/talk_li_detailed.html @@ -33,9 +33,9 @@
{{ $date := .Params.time_start | default .Date }} {{ (time $date).Format $.Site.Params.date_format }} - {{ (time $date).Format "3:04 PM" }} + {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }} {{ with .Params.time_end }} - — {{ (time .).Format "3:04 PM" }} + — {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }} {{ end }}
diff --git a/layouts/partials/talk_li_simple.html b/layouts/partials/talk_li_simple.html index bf97bb6b..0b6a034c 100644 --- a/layouts/partials/talk_li_simple.html +++ b/layouts/partials/talk_li_simple.html @@ -4,7 +4,7 @@
{{ $date := .Params.time_start | default .Date }} {{ (time $date).Format $.Site.Params.date_format }} - {{ (time $date).Format "3:04 PM" }} + {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
{{ if .Params.event_short }} diff --git a/layouts/talk/single.html b/layouts/talk/single.html index 3f5e97fa..2d4708d3 100644 --- a/layouts/talk/single.html +++ b/layouts/talk/single.html @@ -34,9 +34,9 @@ {{ $date := .Params.time_start | default .Date }} {{ (time $date).Format $.Site.Params.date_format }}
- {{ (time $date).Format "3:04 PM" }} + {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }} {{ with .Params.time_end }} - — {{ (time .).Format "3:04 PM" }} + — {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }} {{ end }}