Prechádzať zdrojové kódy

Add option to hide talk time (#350)

* Add `[params.talks]` section to config
Sandra Parsick 7 rokov pred
rodič
commit
acbeb3da92

+ 5 - 0
exampleSite/config.toml

@@ -143,6 +143,11 @@ defaultContentLanguageInSubdir = false
     'Book chapter'  # 6
   ]
 
+  # Configuration of talk pages.
+  [params.talks]
+    # Show talk time?
+    time = true
+
   # Configuration of publication pages.
   [params.publications]
     # Date format (refer to Go's date format: http://fuckinggodateformat.com )

+ 5 - 3
layouts/partials/talk_li_detailed.html

@@ -33,9 +33,11 @@
       <div class="talk-metadata" itemprop="startDate">
         {{ $date := .Params.time_start | default .Date }}
         {{ (time $date).Format $.Site.Params.date_format }}
-        {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
-        {{ with .Params.time_end }}
-        &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
+        {{ if $.Site.Params.talks.time }}
+          {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
+          {{ with .Params.time_end }}
+            &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
+          {{ end }}
         {{ end }}
       </div>
 

+ 3 - 1
layouts/partials/talk_li_simple.html

@@ -4,7 +4,9 @@
   <div itemprop="startDate">
     {{ $date := .Params.time_start | default .Date }}
     {{ (time $date).Format $.Site.Params.date_format }}
-    {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
+    {{ if $.Site.Params.talks.time }}
+      {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
+    {{ end }}
   </div>
   <div class="talk-metadata">
     {{ if .Params.event_short }}

+ 5 - 3
layouts/talk/single.html

@@ -34,9 +34,11 @@
             {{ $date := .Params.time_start | default .Date }}
             {{ (time $date).Format $.Site.Params.date_format }}
             <div class="talk-time">
-              {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
-              {{ with .Params.time_end }}
-              &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
+              {{ if $.Site.Params.talks.time }}
+                {{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
+                {{ with .Params.time_end }}
+                  &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
+                {{ end }}
               {{ end }}
             </div>
           </div>