Sfoglia il codice sorgente

refactor(talk): rename date options in front matter

date, time_start, time_end renamed to publishDate, date, date_end,
respectively.

BREAKING CHANGES: Rename above 3 options in front matter of all talks.

Also, refactor the 404 page so that it just lists the latest 10 pages
overall. This is a more flexible approach than separately listing the
latest pages for only a few different types of content.

See #721
George Cushen 6 anni fa
parent
commit
a622c8d19f

+ 36 - 6
archetypes/home.md

@@ -1,13 +1,43 @@
 +++
-# Custom widget.
-widget = "custom"
-active = true
-date = {{ .Date }}
+# A section created with the Blank widget.
+widget = "blank"  # Do not modify this line!
+active = true  # Activate this widget? true/false
+weight = 1  # Order that this section will appear.
 
 # Note: a full width section format can be enabled by commenting out the `title` and `subtitle` with a `#`.
 title = "{{ replace .Name "-" " " | title }}"
 subtitle = ""
 
-# Order that this section will appear in.
-weight = 100
+[design]
+  # Choose how many columns the section has. Valid values: 1 or 2.
+  columns = "1"
+
+[design.background]
+  # Apply a background color, gradient, or image.
+  #   Uncomment (by removing `#`) an option to apply it.
+  #   Choose a light or dark text color by setting `text_color_light`.
+  #   Any HTML color name or Hex value is valid.
+
+  # Background color.
+  # color = "navy"
+  
+  # Background gradient.
+  # gradient_start = "DeepSkyBlue"
+  # gradient_end = "SkyBlue"
+  
+  # Background image.
+  # image = "image.jpg"  # Name of image in `static/img/`.
+  # image_darken = 0.6  # Darken the image? Range 0-1 where 0 is transparent and 1 is opaque.
+
+  # Text color (true=light or false=dark).
+  # text_color_light = true
+
+[advanced]
+ # Custom CSS. 
+ css_style = ""
+ 
+ # CSS class.
+ css_class = ""
 +++
+
+[**Add some elements here**](https://sourcethemes.com/academic/docs/writing-markdown-latex/)

+ 3 - 0
archetypes/post/index.md

@@ -11,6 +11,9 @@ draft = false
 # Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
 authors = []
 
+# Is this a featured post? (true/false)
+featured = false
+
 # Tags and categories
 # For example, use `tags = []` for no tags, or the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
 tags = []

+ 8 - 6
archetypes/talk/index.md

@@ -1,16 +1,18 @@
 +++
 title = "{{ replace .Name "-" " " | title }}"
-date = {{ .Date }}  # Schedule page publish date.
-
-# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
-authors = []
 
 # Talk start and end times.
 #   End time can optionally be hidden by prefixing the line with `#`.
-time_start = {{ .Date }}
-time_end = {{ .Date }}
+date = {{ .Date }}
+date_end = {{ .Date }}
 all_day = false
 
+# Schedule page publish date (NOT talk date).
+publishDate = {{ .Date }}
+
+# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
+authors = []
+
 # Location of event.
 location = ""
 

+ 11 - 6
exampleSite/content/talk/example/index.md

@@ -1,16 +1,18 @@
 +++
 title = "Example Talk"
-date = 2017-01-01T00:00:00  # Schedule page publish date (not talk date).
-
-# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
-authors = []
 
 # Talk start and end times.
 #   End time can optionally be hidden by prefixing the line with `#`.
-time_start = 2030-06-01T13:00:00
-time_end = 2030-06-01T15:00:00
+date = 2030-06-01T13:00:00
+date_end = 2030-06-01T15:00:00
 all_day = false
 
+# Schedule page publish date (NOT talk date).
+publishDate = 2017-01-01T00:00:00
+
+# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
+authors = []
+
 # Location of event.
 location = "London, United Kingdom"
 
@@ -55,6 +57,9 @@ url_pdf = ""
 url_video = ""
 url_code = ""
 
+# Demo talk page uses LaTeX math.
+math = true
+
 # Featured image
 # To use, add an image named `featured.jpg/png` to your page's folder. 
 [image]

+ 9 - 38
layouts/404.html

@@ -5,44 +5,15 @@
   <h1>{{ i18n "page_not_found" }}</h1>
   <p>{{ i18n "404_recommendations" }}</p>
 
-  {{ $posts_len := len (where .Site.RegularPages "Section" "post") }}
-  {{ if gt $posts_len 0 }}
-  <h2>{{ i18n "posts" }}</h2>
-  {{ range first 5 (where .Site.RegularPages "Section" "post") }}
-  <ul>
-    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
-  </ul>
-  {{ end }}
-  {{ end }}
-
-  {{ $pubs_len := len (where .Site.RegularPages "Section" "publication") }}
-  {{ if gt $pubs_len 0 }}
-  <h2>{{ i18n "publications" }}</h2>
-  {{ range first 5 (where .Site.RegularPages "Section" "publication") }}
-  <ul>
-    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
-  </ul>
-  {{ end }}
-  {{ end }}
-
-  {{ $talks_len := len (where .Site.RegularPages "Section" "talk") }}
-  {{ if gt $talks_len 0 }}
-  <h2>{{ i18n "talks" }}</h2>
-  {{ range first 5 (sort (where .Site.RegularPages "Type" "talk") ".Params.time_start" "desc") }}
-  <ul>
-    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
-  </ul>
-  {{ end }}
-  {{ end }}
-
-  {{ $projects_len := len (where .Site.RegularPages "Section" "project") }}
-  {{ if gt $projects_len 0 }}
-  <h2>{{ i18n "projects" }}</h2>
-  {{ range first 5 (where .Site.RegularPages "Section" "project") }}
-  <ul>
-    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
-  </ul>
-  {{ end }}
+  {{ $query := .Site.RegularPages }}
+  {{ $count := len $query }}
+  {{ if gt $count 0 }}
+    <h2>{{ i18n "user_profile_latest" }}</h2>
+    {{ range first 10 $query }}
+    <ul>
+      <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+    </ul>
+    {{ end }}
   {{ end }}
 
 </div>

+ 2 - 2
layouts/partials/li_card.html

@@ -36,11 +36,11 @@
     </div>
     {{ end }}
     <span itemprop="startDate">
-      {{ $date := $item.Params.time_start | default $item.Date }}
+      {{ $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 .Params.time_end }}
+        {{ with $item.Params.date_end }}
         &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
         {{ end }}
       {{ end }}

+ 2 - 2
layouts/partials/li_compact.html

@@ -45,11 +45,11 @@
       {{ if eq $item.Type "talk" }}
       <div>
         <span itemprop="startDate">
-          {{ $date := $item.Params.time_start | default $item.Date }}
+          {{ $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 .Params.time_end }}
+            {{ with $item.Params.date_end }}
             &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
             {{ end }}
           {{ end }}

+ 2 - 2
layouts/partials/li_list.html

@@ -25,11 +25,11 @@
   {{ if eq $item.Type "talk" }}
   <div class="article-metadata">
     <span itemprop="startDate">
-      {{ $date := $item.Params.time_start | default $item.Date }}
+      {{ $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 .Params.time_end }}
+        {{ with $item.Params.date_end }}
         &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
         {{ end }}
       {{ end }}

+ 3 - 8
layouts/partials/widgets/featured.html

@@ -24,14 +24,9 @@
   {{ $query = $query | intersect $archive_page.Pages }}
 {{ end }}
 
-{{/* Sort */}}
-{{ $sort_by := "" }}
-{{ if eq $items_type "talk" }}
-  {{ $sort_by = "Params.time_start" }}
-{{ else }}
-  {{ $sort_by = "Date" }}
-{{ end }}
-{{ $query = sort $query $sort_by $items_sort }}
+{{/* Sort (use Hugo default for now) */}}
+{{/* $sort_by := "Date" */}}
+{{/* $query = sort $query $sort_by $items_sort */}}
 
 {{/* Limit */}}
 {{ $query = first $items_count $query }}

+ 3 - 8
layouts/partials/widgets/pages.html

@@ -34,14 +34,9 @@
   {{ $query = where $query "Params.featured" "!=" true }}
 {{ end }}
 
-{{/* Sort */}}
-{{ $sort_by := "" }}
-{{ if eq $items_type "talk" }}
-  {{ $sort_by = "Params.time_start" }}
-{{ else }}
-  {{ $sort_by = "Date" }}
-{{ end }}
-{{ $query = sort $query $sort_by $items_sort }}
+{{/* Sort (use Hugo default for now) */}}
+{{/* $sort_by := "Date" */}}
+{{/* $query = sort $query $sort_by $items_sort */}}
 
 {{/* Offset and Limit */}}
 {{ if gt $items_offset 0 }}

+ 1 - 1
layouts/project/single.html

@@ -53,7 +53,7 @@
     {{ $talks_len := len $items }}
     {{ if ge $talks_len 1 }}
       <h2>{{ (i18n "talks") }}</h2>
-      {{ range sort $items ".Params.time_start" "desc" }}
+      {{ range $items }}
         {{ if eq $page.Site.Params.projects.talk_view 1 }}
           {{ partial "li_list" . }}
         {{ else if eq $page.Site.Params.projects.talk_view 3 }}

+ 1 - 1
layouts/section/talk.html

@@ -18,7 +18,7 @@
         </div>
         <div class="col-lg-10">
 
-          {{ range sort .Pages ".Params.time_start" "desc" }}
+          {{ range .Pages }}
             {{ if eq $.Params.view 1 }}
               {{ partial "li_list" . }}
             {{ else if eq $.Params.view 3 }}

+ 3 - 3
layouts/talk/single.html

@@ -8,7 +8,7 @@
 
     {{ if .Params.abstract }}
       <h3>{{ i18n "abstract" }}</h3>
-      <p class="pub-abstract" itemprop="text">{{ .Params.abstract | markdownify }}</p>
+      <p class="pub-abstract" itemprop="text">{{ .Params.abstract | markdownify | emojify }}</p>
     {{ else }}
       <br>
     {{ end }}
@@ -19,12 +19,12 @@
         <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 := .Params.time_start | default .Date }}
+            {{ $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.time_end }}
+                {{ with .Params.date_end }}
                   &mdash; {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }}
                 {{ end }}
               {{ end }}