From a622c8d19fc68164cd91ed5a40cc6b1a5e21e04c Mon Sep 17 00:00:00 2001 From: George Cushen Date: Wed, 27 Feb 2019 21:48:16 +0000 Subject: [PATCH] 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 --- archetypes/home.md | 42 +++++++++++++++++--- archetypes/post/index.md | 3 ++ archetypes/talk/index.md | 14 ++++--- exampleSite/content/talk/example/index.md | 17 +++++--- layouts/404.html | 47 +++++------------------ layouts/partials/li_card.html | 4 +- layouts/partials/li_compact.html | 4 +- layouts/partials/li_list.html | 4 +- layouts/partials/widgets/featured.html | 11 ++---- layouts/partials/widgets/pages.html | 11 ++---- layouts/project/single.html | 2 +- layouts/section/talk.html | 2 +- layouts/talk/single.html | 6 +-- 13 files changed, 84 insertions(+), 83 deletions(-) diff --git a/archetypes/home.md b/archetypes/home.md index 940323c6..674e7afb 100644 --- a/archetypes/home.md +++ b/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/) diff --git a/archetypes/post/index.md b/archetypes/post/index.md index 79d867e9..055195d9 100644 --- a/archetypes/post/index.md +++ b/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 = [] diff --git a/archetypes/talk/index.md b/archetypes/talk/index.md index 50693ac9..0ffeb65a 100644 --- a/archetypes/talk/index.md +++ b/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 = "" diff --git a/exampleSite/content/talk/example/index.md b/exampleSite/content/talk/example/index.md index 7dfcddc1..8bbc71f0 100644 --- a/exampleSite/content/talk/example/index.md +++ b/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] diff --git a/layouts/404.html b/layouts/404.html index db711564..abcafdf0 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -5,44 +5,15 @@

{{ i18n "page_not_found" }}

{{ i18n "404_recommendations" }}

- {{ $posts_len := len (where .Site.RegularPages "Section" "post") }} - {{ if gt $posts_len 0 }} -

{{ i18n "posts" }}

- {{ range first 5 (where .Site.RegularPages "Section" "post") }} - - {{ end }} - {{ end }} - - {{ $pubs_len := len (where .Site.RegularPages "Section" "publication") }} - {{ if gt $pubs_len 0 }} -

{{ i18n "publications" }}

- {{ range first 5 (where .Site.RegularPages "Section" "publication") }} - - {{ end }} - {{ end }} - - {{ $talks_len := len (where .Site.RegularPages "Section" "talk") }} - {{ if gt $talks_len 0 }} -

{{ i18n "talks" }}

- {{ range first 5 (sort (where .Site.RegularPages "Type" "talk") ".Params.time_start" "desc") }} - - {{ end }} - {{ end }} - - {{ $projects_len := len (where .Site.RegularPages "Section" "project") }} - {{ if gt $projects_len 0 }} -

{{ i18n "projects" }}

- {{ range first 5 (where .Site.RegularPages "Section" "project") }} - - {{ end }} + {{ $query := .Site.RegularPages }} + {{ $count := len $query }} + {{ if gt $count 0 }} +

{{ i18n "user_profile_latest" }}

+ {{ range first 10 $query }} + + {{ end }} {{ end }} diff --git a/layouts/partials/li_card.html b/layouts/partials/li_card.html index 5a86369b..eed169b7 100644 --- a/layouts/partials/li_card.html +++ b/layouts/partials/li_card.html @@ -36,11 +36,11 @@ {{ end }} - {{ $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 }} — {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }} {{ end }} {{ end }} diff --git a/layouts/partials/li_compact.html b/layouts/partials/li_compact.html index eb051fc8..71e12bad 100644 --- a/layouts/partials/li_compact.html +++ b/layouts/partials/li_compact.html @@ -45,11 +45,11 @@ {{ if eq $item.Type "talk" }}
- {{ $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 }} — {{ (time .).Format ($.Site.Params.time_format | default "3:04 PM") }} {{ end }} {{ end }} diff --git a/layouts/partials/li_list.html b/layouts/partials/li_list.html index 3ec5bc33..cc437f67 100644 --- a/layouts/partials/li_list.html +++ b/layouts/partials/li_list.html @@ -25,11 +25,11 @@ {{ if eq $item.Type "talk" }}
- {{ range sort .Pages ".Params.time_start" "desc" }} + {{ range .Pages }} {{ if eq $.Params.view 1 }} {{ partial "li_list" . }} {{ else if eq $.Params.view 3 }} diff --git a/layouts/talk/single.html b/layouts/talk/single.html index ee3a7c35..1ec7b279 100644 --- a/layouts/talk/single.html +++ b/layouts/talk/single.html @@ -8,7 +8,7 @@ {{ if .Params.abstract }}

{{ i18n "abstract" }}

-

{{ .Params.abstract | markdownify }}

+

{{ .Params.abstract | markdownify | emojify }}

{{ else }}
{{ end }} @@ -19,12 +19,12 @@
{{ i18n "date" }}