Sfoglia il codice sorgente

1) Add `image` option to page preamble to enable displaying an image in publication, post, and project page headers; 2) add detailed publication list to homepage, enabled by setting `detailed_list = true` under `[params.publications]` in `config.toml`.

George Cushen 9 anni fa
parent
commit
f06857f9d9

+ 0 - 1
archetypes/post.md

@@ -1,6 +1,5 @@
 +++
 image = ""
-image_preview = ""
 math = false
 tags = []
 +++

+ 0 - 2
archetypes/project.md

@@ -2,8 +2,6 @@
 tags = []
 summary = ""
 image = ""
-image_preview = ""
 math = false
-client_name = ""
 external_link = ""
 +++

+ 2 - 0
archetypes/publication.md

@@ -1,10 +1,12 @@
 +++
 abstract = ""
+abstract_short = ""
 authors = [""]
 image = ""
 image_preview = ""
 math = false
 publication = ""
+publication_short = ""
 url_pdf = ""
 url_code = ""
 url_dataset = ""

+ 1 - 0
exampleSite/config.toml

@@ -59,6 +59,7 @@ googleAnalytics = ""
   # Section will only be displayed if there are publications in `content/publication/`.
   [params.publications]
     count = 10
+    detailed_list = false
     title = "Recent Publications"
     subtitle = ""
     str_all = "More Publications"

+ 6 - 0
layouts/_default/single.html

@@ -3,6 +3,11 @@
 <div class="container">
 
     <article class="article" itemscope itemtype="http://schema.org/Article">
+
+        {{ if .Params.image }}
+        <img src="{{ $.Site.BaseURL }}img/{{ .Params.image }}" class="article-banner" itemprop="image">
+        {{end}}
+
         <h1 itemprop="name">{{ .Title }}</h1>
 
         {{ partial "article_metadata" (dict "content" . "is_list" 0) }}
@@ -10,6 +15,7 @@
         <div class="article-style" itemprop="articleBody">
             {{ .Content }}
         </div>
+
     </article>
 
     {{ partial "section_pager.html" . }}

+ 15 - 4
layouts/index.html

@@ -35,15 +35,21 @@
                 {{ end }}
             </div>
             <div class="col-xs-12 col-md-8">
+                {{ if .Site.Params.publications.detailed_list }}
+                {{ range first .Site.Params.publications.count (where .Data.Pages "Type" "publication") }}
+                {{ partial "publication_list_item" . }}
+                {{ end }}
+                {{ else }}
                 <ul class="fa-ul">
-                    {{ range $index, $page := first .Site.Params.publications.count (where .Data.Pages "Type" "publication") }}
+                    {{ range first .Site.Params.publications.count (where .Data.Pages "Type" "publication") }}
                     <li itemscope itemtype="http://schema.org/CreativeWork">
                         <i class="fa-li fa fa-file-text-o pub-icon" aria-hidden="true"></i>
                         <span itemprop="name">{{ .Title }}</span>
-                        <p>{{ partial "publication_links" (dict "content" $page "is_list" 1) }}</p>
+                        <p>{{ partial "publication_links" (dict "content" . "is_list" 1) }}</p>
                     </li>
                     {{ end }}
                 </ul>
+                {{ end }}
             </div>
         </div>
     </div>
@@ -71,8 +77,13 @@
             </div>
             <div class="col-xs-12 col-md-8">
                 {{ range first .Site.Params.posts.count (where .Data.Pages "Type" "post") }}
-                <div class="article-list-item" itemscope="" itemprop="blogPost">
-                    <h3 class="post-title" itemprop="name"><a href="{{ .Permalink }}" itemprop="url">{{ .Title }}</a></h3>
+                <div class="article-list-item" itemscope itemprop="blogPost">
+                    {{ if .Params.image }}
+                    <a href="{{ .Permalink }}">
+                        <img src="{{ $.Site.BaseURL }}img/{{ .Params.image }}" class="article-banner" itemprop="image">
+                    </a>
+                    {{end}}
+                    <h3 class="article-title" itemprop="name"><a href="{{ .Permalink }}" itemprop="url">{{ .Title }}</a></h3>
                     {{ partial "article_metadata" (dict "content" . "is_list" 1) }}
                     <p class="article-style" itemprop="articleBody">
                         {{ if .Truncated }}

+ 53 - 0
layouts/partials/publication_list_item.html

@@ -0,0 +1,53 @@
+<div class="pub-list-item" itemscope itemtype="http://schema.org/CreativeWork">
+    <div class="row">
+        {{ if .Params.image_preview }}
+        <div class="col-md-12">
+            <a href="{{ .Permalink }}">
+                <img src="{{ $.Site.BaseURL }}img/{{ .Params.image_preview }}" class="pub-banner" itemprop="image">
+            </a>
+        </div>
+        <div class="col-md-12">
+        {{ else if .Params.image}}
+        <div class="col-md-12">
+            <a href="{{ .Permalink }}">
+                <img src="{{ $.Site.BaseURL }}img/{{ .Params.image }}" class="pub-banner" itemprop="image">
+            </a>
+        </div>
+        <div class="col-md-12">
+        {{ else }}
+        <div class="col-md-12">
+        {{end}}
+
+            <h3 class="article-title" itemprop="name">
+                <a href="{{ .Permalink }}" itemprop="url">{{ .Title }}</a>
+            </h3>
+
+            <div class="pub-abstract" itemprop="text">
+                {{ if .Params.abstract_short }}
+                    {{ .Params.abstract_short }}
+                {{ else }}
+                    {{ .Params.abstract }}
+                {{ end }}
+            </div>
+
+            <div class="pub-authors" itemprop="author">
+                {{ with .Params.authors }}
+                {{ delimit . ", " }}
+                {{ end }}
+            </div>
+
+            <div class="pub-publication">
+                {{ if .Params.publication_short }}
+                    {{ .Params.publication_short | markdownify }}
+                {{ else }}
+                    {{ .Params.publication | markdownify }}
+                {{ end }}
+            </div>
+
+            <div class="pub-links">
+                {{ partial "publication_links" (dict "content" . "is_list" 1) }}
+            </div>
+
+        </div>
+    </div>
+</div>

+ 4 - 0
layouts/project/single.html

@@ -3,6 +3,10 @@
 <div class="container">
 
     <article class="article article-project" itemscope itemtype="http://schema.org/Article">
+        {{ if .Params.image }}
+        <img src="{{ $.Site.BaseURL }}img/{{ .Params.image }}" class="article-banner" itemprop="image">
+        {{end}}
+
         <h1 itemprop="name">{{ .Title }}</h1>
 
         {{ with .Params.external_link }}<a class="btn btn-primary btn-outline" href="{{ . }}">Go to Project Site</a>{{ end }}

+ 12 - 8
layouts/publication/single.html

@@ -2,10 +2,10 @@
 {{ partial "navbar.html" . }}
 <div class="container">
 
-    <div id="pub">
+    <div class="pub" itemscope itemtype="http://schema.org/CreativeWork">
         <div class="pub-title">
-            <h1>{{ .Title }}</h1>
-            <span class="citation_authors">
+            <h1 itemprop="name">{{ .Title }}</h1>
+            <span class="pub-authors" itemprop="author">
                 {{ with .Params.authors }}
                 {{ delimit . ", " }}
                 {{ end }}
@@ -15,14 +15,18 @@
             </span>
         </div>
 
+        {{ if .Params.image }}
+        <img src="{{ $.Site.BaseURL }}img/{{ .Params.image }}" class="pub-banner" itemprop="image">
+        {{end}}
+
         <h3>Abstract</h3>
-        <p>{{ .Params.abstract }}</p>
+        <p class="pub-abstract" itemprop="text">{{ .Params.abstract }}</p>
 
         <div class="row">
             <div class="col-sm-1"></div>
             <div class="col-sm-10">
                 <div class="row">
-                    <div class="col-xs-12 col-sm-3" style="font-weight: bold">Publication</div>
+                    <div class="col-xs-12 col-sm-3 pub-row-heading">Publication</div>
                     <div class="col-xs-12 col-sm-9">{{ .Params.publication | markdownify }}</div>
                 </div>
             </div>
@@ -34,8 +38,8 @@
             <div class="col-sm-1"></div>
             <div class="col-sm-10">
                 <div class="row">
-                    <div class="col-xs-12 col-sm-3" style="font-weight: bold">Date</div>
-                    <div class="col-xs-12 col-sm-9">{{ .Date.Format "January, 2006" }}</div>
+                    <div class="col-xs-12 col-sm-3 pub-row-heading">Date</div>
+                    <div class="col-xs-12 col-sm-9" itemprop="datePublished">{{ .Date.Format "January, 2006" }}</div>
                 </div>
             </div>
             <div class="col-sm-1"></div>
@@ -46,7 +50,7 @@
             <div class="col-sm-1"></div>
             <div class="col-sm-10">
                 <div class="row">
-                    <div class="col-xs-12 col-sm-3" style="font-weight: bold; line-height:34px;">Links</div>
+                    <div class="col-xs-12 col-sm-3 pub-row-heading" style="line-height:34px;">Links</div>
                     <div class="col-xs-12 col-sm-9">
 
                         {{ partial "publication_links" (dict "content" . "is_list" 0) }}

+ 5 - 0
layouts/section/post.html

@@ -7,6 +7,11 @@
     {{ $paginator := .Paginate .Data.Pages }}
     {{ range $paginator.Pages }}
     <div>
+        {{ if .Params.image }}
+        <a href="{{ .Permalink }}">
+            <img src="{{ $.Site.BaseURL }}img/{{ .Params.image }}" class="article-banner">
+        </a>
+        {{end}}
         <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
         {{ partial "article_metadata" (dict "content" . "is_list" 1) }}
         <div class="article-style"><p>{{ .Summary }}</p></div>

+ 65 - 12
static/css/hugo-academic.css

@@ -74,7 +74,7 @@ h4 {
 }
 
 a, a:visited,
-h3.post-title a:hover {
+h3.article-title a:hover {
     color: #0095eb;
     text-decoration:none;
     transition:color 0.6s ease;
@@ -84,11 +84,6 @@ a:hover {
     color: #005181;
 }
 
-h3.post-title a {
-    color: #151515;
-    transition: color 0.6s ease;
-}
-
 img,
 video {
     height: auto;
@@ -306,6 +301,15 @@ ul.share li:hover .fa {
  *  Blog Articles
  **************************************************/
 
+.article-title {
+    font-size: 1.75rem;
+}
+
+h3.article-title a {
+    color: #151515;
+    transition: color 0.6s ease;
+}
+
 .article-metadata {
     margin-bottom: 20px;
     line-height: 30px; /* Match share bar line height. */
@@ -313,6 +317,14 @@ ul.share li:hover .fa {
     letter-spacing: 0.03em;
 }
 
+.article-metadata a:hover {
+    color: #0095eb;
+}
+
+.article-metadata a {
+    color: #888;
+}
+
 .article-list-item {
     margin-bottom: 40px;
 }
@@ -331,6 +343,11 @@ ul.share li:hover .fa {
     color: #888;
 }
 
+.article-banner {
+    width: 100%;
+    height: auto;
+}
+
 .article-style img,
 .article-style video {
     box-shadow: 1px 1px 0px #edefed,-1px -1px 0px #edefed,1px -1px 0px #edefed,-1px 1px 0px #edefed;
@@ -360,18 +377,54 @@ ul.share li:hover .fa {
  *  Publications
  **************************************************/
 
-#pub_list h3 {
-    margin-top: 0;
-}
-
 .pub-icon {
     color: #03396c;
     font-size: 0.81em;
     padding-top: 6px;
 }
 
-.citation_authors {
+.pub-banner {
+    max-width: 100%;
+    height: auto;
+    margin-left: auto;
+    margin-right: auto;
+}
+
+.pub .pub-title {
+    margin-bottom: 5px;
+}
+
+.pub .pub-authors {
     font-style: italic;
+    line-height: 30px; /* Match share bar line height. */
+}
+
+.pub .pub-row-heading {
+    font-weight: bold;
+}
+
+.pub-list-item {
+    margin-bottom: 40px;
+}
+
+.pub-list-item .pub-abstract {
+    font-size: 1.13em;
+}
+
+.pub-list-item .pub-authors {
+    line-height: normal;
+    font-style: normal;
+    font-size: 1.13em;
+    color: #3170A5;
+}
+
+.pub-list-item .pub-publication {
+    color: #090;
+    font-size: 1em;
+}
+
+.pub-list-item .pub-links {
+    padding-top: 10px;
 }
 
 /*************************************************
@@ -456,8 +509,8 @@ footer a#back_to_top i {
 }
 
 .btn-primary.btn-outline {
-    /*color: #428bca;*/
     color: #0095eb;
+    border-color: #0095eb;
 }
 
 .btn-success.btn-outline {