Selaa lähdekoodia

Add optional stream layout with featured image for publications + talks

- exampleSite: Add featured images to talks and publications
- exampleSite: Change default layouts to use stream layout

Close #718
George Cushen 6 vuotta sitten
vanhempi
commit
faa4812677

+ 2 - 1
exampleSite/content/home/publications.md

@@ -19,7 +19,8 @@ count = 10
 #   1 = Detailed
 #   2 = APA
 #   3 = MLA
-list_format = 3
+#   4 = Stream
+list_format = 4
 
 # Filter by publication type.
 # -1: Any

+ 1 - 0
exampleSite/content/home/publications_selected.md

@@ -17,6 +17,7 @@ weight = 10
 #   1 = Detailed
 #   2 = APA
 #   3 = MLA
+#   4 = Stream
 list_format = 1
 
 # Filter by publication type.

+ 2 - 1
exampleSite/content/home/talks.md

@@ -16,7 +16,8 @@ count = 10
 # List format.
 #   0 = Simple
 #   1 = Detailed
-list_format = 0
+#   2 = Stream
+list_format = 2
 
 # Exclude talks that are shown in the Selected Talks widget?
 exclude_selected = false

+ 1 - 0
exampleSite/content/home/talks_selected.md

@@ -13,5 +13,6 @@ weight = 29
 # List format.
 #   0 = Simple
 #   1 = Detailed
+#   3 = Stream
 list_format = 0
 +++

+ 2 - 3
exampleSite/content/post/_index.md

@@ -1,13 +1,12 @@
 +++
 title = "Posts"
 date = 2017-01-01T00:00:00
-math = false
-highlight = false
 
 # List format.
 #   0 = Simple
 #   1 = Detailed
-list_format = 1
+#   2 = Stream
+list_format = 2
 
 # Optional featured image (relative to `static/img/` folder).
 [header]

+ 1 - 2
exampleSite/content/publication/_index.md

@@ -1,14 +1,13 @@
 +++
 title = "Publications"
 date = 2017-01-01T00:00:00
-math = false
-highlight = false
 
 # List format.
 #   0 = Simple
 #   1 = Detailed
 #   2 = APA
 #   3 = MLA
+#   4 = Stream
 list_format = 3
 
 # Optional featured image (relative to `static/img/` folder).

BIN
exampleSite/content/publication/clothing-search/featured.jpg


+ 8 - 11
exampleSite/content/publication/clothing-search.md → exampleSite/content/publication/clothing-search/index.md

@@ -25,9 +25,6 @@ publication_short = "In *ICMEW*"
 abstract = "We present a mobile visual clothing search system whereby a smart phone user can either choose a social networking photo or take a new photo of a person wearing clothing of interest and search for similar clothing in a retail database. From the query image, the person is detected, clothing is segmented, and clothing features are extracted and quantized. The information is sent from the phone client to a server, where the feature vector of the query image is used to retrieve similar clothing products from online databases. The phone's GPS location is used to re-rank results by retail store location. State of the art work focuses primarily on the recognition of a diverse range of clothing offline and pays little attention to practical applications. Evaluated on a challenging dataset, the system is relatively fast and achieves promising results."
 abstract_short = "A mobile visual clothing search system is presented whereby a smart phone user can either choose a social networking image or capture a new photo of a person wearing clothing of interest and search for similar clothing in a large cloud-based ecommerce database. The phone's GPS location is used to re-rank results by retail store location, to inform the user of local stores where similar clothing items can be tried on."
 
-# Featured image thumbnail (optional)
-image_preview = ""
-
 # Is this a selected publication? (true/false)
 selected = true
 
@@ -63,15 +60,15 @@ doi = ""
 # Does this page contain LaTeX math? (true/false)
 math = true
 
-# Does this page require source code highlighting? (true/false)
-highlight = true
-
 # Featured image
-# Place your image in the `static/img/` folder and reference its filename below, e.g. `image = "example.jpg"`.
-[header]
-image = "headers/bubbles-wide.jpg"
-caption = "My caption :smile:"
-
+# To use, add an image named `featured.jpg/png` to your page's folder. 
+[image]
+  # Caption (optional)
+  caption = "Image credit: [**Unsplash**](https://unsplash.com/photos/pLCdAaMFLTE)"
+
+  # Focal point (optional)
+  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
+  focal_point = ""
 +++
 
 More detail can easily be written here using *Markdown* and $\rm \LaTeX$ math code.

BIN
exampleSite/content/publication/person-re-id/featured.jpg


+ 8 - 11
exampleSite/content/publication/person-re-identification.md → exampleSite/content/publication/person-re-id/index.md

@@ -25,9 +25,6 @@ publication_short = "In *SITIS*"
 abstract = "Person re-identification is a critical security task for recognizing a person across spatially disjoint sensors. Previous work can be computationally intensive and is mainly based on low-level cues extracted from RGB data and implemented on a PC for a fixed sensor network (such as traditional CCTV). We present a practical and efficient framework for mobile devices (such as smart phones and robots) where high-level semantic soft biometrics are extracted from RGB and depth data. By combining these cues, our approach attempts to provide robustness to noise, illumination, and minor variations in clothing. This mobile approach may be particularly useful for the identification of persons in areas ill-served by fixed sensors or for tasks where the sensor position and direction need to dynamically adapt to a target. Results on the BIWI dataset are preliminary but encouraging. Further evaluation and demonstration of the system will be available on our website."
 abstract_short = ""
 
-# Featured image thumbnail (optional)
-image_preview = ""
-
 # Is this a selected publication? (true/false)
 selected = false
 
@@ -63,15 +60,15 @@ doi = ""
 # Does this page contain LaTeX math? (true/false)
 math = true
 
-# Does this page require source code highlighting? (true/false)
-highlight = true
-
 # Featured image
-# Place your image in the `static/img/` folder and reference its filename below, e.g. `image = "example.jpg"`.
-[header]
-image = ""
-caption = ""
-
+# To use, add an image named `featured.jpg/png` to your page's folder. 
+[image]
+  # Caption (optional)
+  caption = "Image credit: [**Unsplash**](https://unsplash.com/photos/jdD8gXaTZsc)"
+
+  # Focal point (optional)
+  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
+  focal_point = ""
 +++
 
 More detail can easily be written here using *Markdown* and $\rm \LaTeX$ math code.

+ 2 - 3
exampleSite/content/talk/_index.md

@@ -1,13 +1,12 @@
 +++
 title = "Recent & Upcoming Talks"
 date = 2017-01-01T00:00:00
-math = false
-highlight = false
 
 # List format.
 #   0 = Simple
 #   1 = Detailed
-list_format = 0
+#   2 = Stream
+list_format = 2
 
 # Optional featured image (relative to `static/img/` folder).
 [header]

BIN
exampleSite/content/talk/example/featured.jpg


+ 10 - 10
exampleSite/content/talk/example-talk.md → exampleSite/content/talk/example/index.md

@@ -12,8 +12,8 @@ time_end = 2030-06-01T15:00:00
 authors = []
 
 # Abstract and optional shortened version.
-abstract = ""
-abstract_short = ""
+abstract = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellus ac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam."
+abstract_short = "An example talk using Academic's Markdown slides feature."
 
 # Name of event and optional event URL.
 event = "Academic Theme Conference"
@@ -45,15 +45,15 @@ url_code = ""
 # Does the content use math formatting?
 math = true
 
-# Does the content use source code highlighting?
-highlight = true
-
 # Featured image
-# Place your image in the `static/img/` folder and reference its filename below, e.g. `image = "example.jpg"`.
-[header]
-image = "headers/bubbles-wide.jpg"
-caption = "My caption :smile:"
-
+# To use, add an image named `featured.jpg/png` to your page's folder. 
+[image]
+  # Caption (optional)
+  caption = "Image credit: [**Unsplash**](https://unsplash.com/photos/bzdhc5b3Bxs)"
+
+  # Focal point (optional)
+  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
+  focal_point = "Right"
 +++
 
 {{% alert note %}}

+ 4 - 0
layouts/partials/css/academic.css

@@ -745,6 +745,10 @@ article {
   color: rgba(0,0,0,0.54);
 }
 
+.stream-meta.article-metadata {
+  margin-bottom: 5px;
+}
+
 /* For article page only, not lists. */
 article .article-metadata {
   margin-bottom: 20px;

+ 44 - 0
layouts/partials/publication_li_stream.html

@@ -0,0 +1,44 @@
+<div class="media stream-item" itemscope itemtype="http://schema.org/Event">
+  <div class="media-body">
+
+    <h3 class="article-title mb-0 mt-0" itemprop="name">
+      <a href="{{ .RelPermalink }}" itemprop="url">{{ .Title }}</a>
+    </h3>
+
+    {{ $summary := "" }}
+    {{ if .Params.abstract_short }}
+      {{ $summary = .Params.abstract_short | markdownify }}
+    {{ else if .Params.abstract }}
+      {{ $summary = .Params.abstract | markdownify }}
+    {{ else if .Truncated }}
+      {{ $summary = .Summary }}
+    {{ end }}
+    {{ with $summary }}
+    <div class="article-style" itemprop="articleBody">
+      {{ . | truncate 135 }}
+    </div>
+    {{ end }}
+
+    <div class="stream-meta article-metadata">
+      <div itemprop="author">
+        {{ with .Params.authors }}
+        {{- delimit . ", " | markdownify -}}
+        {{- end -}}
+      </div>
+    </div>
+
+    <div class="talk-links">
+      {{ partial "publication_links" (dict "content" . "is_list" 1) }}
+    </div>
+
+  </div>
+  <div class="ml-3">
+    {{ $resource := (.Resources.ByType "image").GetMatch "*featured*" }}
+    {{ with $resource }}
+    {{ $image := .Resize "150x" }}
+    <a href="{{ $.RelPermalink }}">
+      <img src="{{ $image.RelPermalink }}" itemprop="image">
+    </a>
+    {{end}}
+  </div>
+</div>

+ 60 - 0
layouts/partials/talk_li_stream.html

@@ -0,0 +1,60 @@
+<div class="media stream-item" itemscope itemtype="http://schema.org/Event">
+  <div class="media-body">
+
+    <h3 class="article-title mb-0 mt-0" itemprop="name">
+      <a href="{{ .RelPermalink }}" itemprop="url">{{ .Title }}</a>
+    </h3>
+
+    {{ $summary := "" }}
+    {{ if .Params.abstract_short }}
+      {{ $summary = .Params.abstract_short | markdownify }}
+    {{ else if .Params.abstract }}
+      {{ $summary = .Params.abstract | markdownify }}
+    {{ else if .Truncated }}
+      {{ $summary = .Summary }}
+    {{ end }}
+    {{ with $summary }}
+    <div class="article-style" itemprop="articleBody">
+      {{ . | truncate 135 }}
+    </div>
+    {{ end }}
+
+    <div class="stream-meta article-metadata">
+      <div>
+        {{ $date := .Params.time_start | default .Date }}
+        {{ (time $date).Format $.Site.Params.date_format }}
+        {{ 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 }}
+
+        {{ if .Params.event }}
+          <span class="middot-divider"></span> {{ .Params.event | markdownify }}
+        {{ else if .Params.event_short }}
+          <span class="middot-divider"></span> {{ .Params.event_short | markdownify }}
+        {{ end }}
+      </div>
+      <div itemprop="author">
+        {{ with .Params.authors }}
+        {{- delimit . ", " | markdownify -}}
+        {{- end -}}
+      </div>
+    </div>
+
+    <div class="talk-links">
+      {{ partial "talk_links" (dict "content" . "is_list" 1) }}
+    </div>
+
+  </div>
+  <div class="ml-3">
+    {{ $resource := (.Resources.ByType "image").GetMatch "*featured*" }}
+    {{ with $resource }}
+    {{ $image := .Resize "150x" }}
+    <a href="{{ $.RelPermalink }}">
+      <img src="{{ $image.RelPermalink }}" itemprop="image">
+    </a>
+    {{end}}
+  </div>
+</div>

+ 3 - 1
layouts/partials/widgets/posts.html

@@ -48,8 +48,10 @@
         {{ $params := dict "post" . }}
         {{ if eq $page.Params.list_format 0 }}
           {{ partial "post_li_simple" $params }}
-        {{ else }}
+        {{ else if eq $page.Params.list_format 1 }}
           {{ partial "post_li_detailed" $params }}
+        {{ else }}
+          {{ partial "post_li_stream" $params }}
         {{ end }}
       {{end}}
 

+ 2 - 0
layouts/partials/widgets/publications.html

@@ -37,6 +37,8 @@
         {{ partial "publication_li_apa" . }}
       {{ else if eq $page.Params.list_format 3 }}
         {{ partial "publication_li_mla" . }}
+      {{ else if eq $page.Params.list_format 4 }}
+        {{ partial "publication_li_stream" . }}
       {{ else }}
         {{ partial "publication_li_simple" . }}
       {{ end }}

+ 2 - 0
layouts/partials/widgets/publications_selected.html

@@ -24,6 +24,8 @@
         {{ partial "publication_li_apa" . }}
       {{ else if eq $page.Params.list_format 3 }}
         {{ partial "publication_li_mla" . }}
+      {{ else if eq $page.Params.list_format 4 }}
+        {{ partial "publication_li_stream" . }}
       {{ else }}
         {{ partial "publication_li_simple" . }}
       {{ end }}

+ 2 - 0
layouts/partials/widgets/talks.html

@@ -29,6 +29,8 @@
     {{ range first $page.Params.count (sort ($.Scratch.Get "talks") ".Params.time_start" "desc") }}
       {{ if eq $page.Params.list_format 1 }}
         {{ partial "talk_li_detailed" . }}
+      {{ else if eq $page.Params.list_format 2 }}
+        {{ partial "talk_li_stream" . }}
       {{ else }}
         {{ partial "talk_li_simple" . }}
       {{ end }}

+ 2 - 0
layouts/partials/widgets/talks_selected.html

@@ -13,6 +13,8 @@
     {{ range (sort (where (where $.Site.RegularPages "Type" "talk") ".Params.selected" true) ".Params.time_start" "desc") }}
       {{ if eq $page.Params.list_format 1 }}
         {{ partial "talk_li_detailed" . }}
+      {{ else if eq $page.Params.list_format 2 }}
+        {{ partial "talk_li_stream" . }}
       {{ else }}
         {{ partial "talk_li_simple" . }}
       {{ end }}

+ 3 - 1
layouts/section/post.html

@@ -14,8 +14,10 @@
     {{ $params := dict "post" . }}
     {{ if eq $.Params.list_format 0 }}
       {{ partial "post_li_simple" $params }}
-    {{ else }}
+    {{ else if eq $.Params.list_format 1 }}
       {{ partial "post_li_detailed" $params }}
+    {{ else }}
+      {{ partial "post_li_stream" $params }}
     {{ end }}
   {{ end }}
 

+ 2 - 0
layouts/section/publication.html

@@ -62,6 +62,8 @@
             {{ partial "publication_li_apa" . }}
           {{ else if eq $.Params.list_format 3 }}
             {{ partial "publication_li_mla" . }}
+          {{ else if eq $.Params.list_format 4 }}
+            {{ partial "publication_li_stream" . }}
           {{ else }}
             {{ partial "publication_li_simple" . }}
           {{ end }}

+ 2 - 0
layouts/section/talk.html

@@ -21,6 +21,8 @@
           {{ range sort .Pages ".Params.time_start" "desc" }}
             {{ if eq $.Params.list_format 1 }}
               {{ partial "talk_li_detailed" . }}
+            {{ else if eq $.Params.list_format 2 }}
+              {{ partial "talk_li_stream" . }}
             {{ else }}
               {{ partial "talk_li_simple" . }}
             {{ end }}