Browse Source

talks: Add start and end times (#298 #334)

* show start and end times on talk page
* add `time_start` to talk frontmatter, e.g. `2030-06-01T13:00:00`
* add `time_end` to talk frontmatter, e.g. `2030-06-01T15:00:00`
* update format of talk listings, adding time metadata
George Cushen 7 years ago
parent
commit
df4f44f112

+ 6 - 1
archetypes/talk.md

@@ -1,8 +1,13 @@
 +++
 title = "{{ replace .TranslationBaseName "-" " " | title }}"
-date = {{ .Date }}
+date = {{ .Date }}  # Schedule page publish date.
 draft = false
 
+# Talk start and end times.
+#   End time can optionally be hidden by prefixing the line with `#`.
+time_start = {{ .Date }}
+time_end = {{ .Date }}
+
 # Abstract and optional shortened version.
 abstract = ""
 abstract_short = ""

+ 4 - 1
exampleSite/content/talk/example-talk.md

@@ -1,6 +1,9 @@
 +++
-date = "2017-01-01T00:00:00"
+date = 2017-01-01T00:00:00  # Schedule page publish date.
+
 title = "Example Talk"
+time_start = 2030-06-01T13:00:00
+time_end = 2030-06-01T15:00:00
 abstract = ""
 abstract_short = ""
 event = "Academic Theme Conference"

+ 3 - 3
layouts/partials/css/academic.css

@@ -649,9 +649,9 @@ article {
  * Talks
  **************************************************/
 
-.talk-event {
-  color: #090;
-  font-size: 1rem;
+.talk-metadata {
+  color: #4b4f56;
+  font-size: 0.8rem;
 }
 
 /*************************************************

+ 18 - 9
layouts/partials/talk_li_detailed.html

@@ -1,4 +1,4 @@
-<div class="pub-list-item" itemscope itemtype="http://schema.org/CreativeWork">
+<div class="pub-list-item" itemscope itemtype="http://schema.org/Event">
   <div class="row">
 
     {{ if .Params.image_preview }}
@@ -30,19 +30,28 @@
         <a href="{{ .Permalink }}" itemprop="url">{{ .Title }}</a>
       </h3>
 
-      <div class="talk-abstract" itemprop="text">
-        {{ if .Params.abstract_short }}
-        {{ .Params.abstract_short | markdownify }}
-        {{ else }}
-        {{ .Params.abstract | markdownify }}
+      <div class="talk-metadata" itemprop="startDate">
+        {{ $date := .Params.time_start | default .Date }}
+        {{ (time $date).Format $.Site.Params.date_format }}
+        {{ (time $date).Format "3:00 PM" }}
+        {{ with .Params.time_end }}
+        &mdash; {{ (time .).Format "3:00 PM" }}
         {{ end }}
       </div>
 
-      <div class="talk-event">
+      <div class="talk-metadata">
         {{ if .Params.event }}
-          {{ .Params.event | markdownify }}
+        {{ .Params.event | markdownify }}
         {{ else if .Params.event_short }}
-          {{ .Params.event_short | markdownify }}
+        {{ .Params.event_short | markdownify }}
+        {{ end }}
+      </div>
+
+      <div class="talk-abstract" itemprop="text">
+        {{ if .Params.abstract_short }}
+        {{ .Params.abstract_short | markdownify }}
+        {{ else }}
+        {{ .Params.abstract | markdownify }}
         {{ end }}
       </div>
 

+ 11 - 4
layouts/partials/talk_li_simple.html

@@ -1,12 +1,19 @@
-<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/CreativeWork">
+<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/Event">
   <i class="fa fa-comment-o pub-icon" aria-hidden="true"></i>
   <span itemprop="name"><a href="{{ .Permalink }}">{{ .Title }}</a></span>
-  <p>
-    {{ .Date.Format $.Site.Params.date_format }},
+  <div itemprop="startDate">
+    {{ $date := .Params.time_start | default .Date }}
+    {{ (time $date).Format $.Site.Params.date_format }}
+    {{ (time $date).Format "3:00 PM" }}
+  </div>
+  <div class="talk-metadata">
     {{ if .Params.event_short }}
         {{ .Params.event_short | markdownify }}
     {{ else if .Params.event }}
             {{ .Params.event | markdownify }}
     {{ end }}
-  </p>
+  </div>
+  <div class="talk-links">
+    {{ partial "talk_links" (dict "content" . "is_list" 1) }}
+  </div>
 </div>

+ 10 - 3
layouts/talk/single.html

@@ -1,6 +1,6 @@
 {{ partial "header.html" . }}
 {{ partial "navbar.html" . }}
-<div class="pub" itemscope itemtype="http://schema.org/CreativeWork">
+<div class="pub" itemscope itemtype="http://schema.org/Event">
 
   {{ partial "header_image.html" . }}
 
@@ -31,7 +31,14 @@
         <div class="row">
           <div class="col-xs-12 col-sm-3 pub-row-heading">{{ i18n "date" }}</div>
           <div class="col-xs-12 col-sm-9" itemprop="datePublished">
-            {{ .Date.Format $.Site.Params.date_format }}
+            {{ $date := .Params.time_start | default .Date }}
+            {{ (time $date).Format $.Site.Params.date_format }}
+            <div class="talk-time">
+              {{ (time $date).Format "3:00 PM" }}
+              {{ with .Params.time_end }}
+              &mdash; {{ (time .).Format "3:00 PM" }}
+              {{ end }}
+            </div>
           </div>
         </div>
       </div>
@@ -69,7 +76,7 @@
     <div class="visible-xs space-below"></div>
     {{ end }}
 
-    {{ if .Params.url_pdf | or .Params.url_slides | or .Params.url_video | or .Params.url_custom }}
+    {{ if .Params.url_pdf | or .Params.url_slides | or .Params.url_video | or .Params.url_code | or .Params.projects | or .Params.url_custom }}
     <div class="row" style="padding-top: 10px">
       <div class="col-sm-1"></div>
       <div class="col-sm-10">