From c0fba102df3538ac525e1be80c77a592f730d6f6 Mon Sep 17 00:00:00 2001
From: Thomas Wood <thomas.wood09@imperial.ac.uk>
Date: Wed, 3 Feb 2016 19:01:59 +0000
Subject: [PATCH] Tidy up publication template for missing fields

---
 _includes/publication-venue.html |  2 +-
 _layouts/publication-entry.html  |  2 +-
 _layouts/publication.html        | 23 ++++++++++++++---------
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/_includes/publication-venue.html b/_includes/publication-venue.html
index f3d125e..a8e245c 100644
--- a/_includes/publication-venue.html
+++ b/_includes/publication-venue.html
@@ -1 +1 @@
-{% if entry.jorurnal %}{{ entry.journal }}{% elsif entry.booktitle %}{{ entry.booktitle }}{% elsif entry.institution %}{{ entry.institution }}{% elsif entry.school %}{{ entry.school }}{% endif %}
+{% if include.entry.jorurnal %}{{ include.entry.journal }}{% elsif include.entry.booktitle %}{{ include.entry.booktitle }}{% elsif include.entry.institution %}{{ include.entry.institution }}{% elsif include.entry.school %}{{ include.entry.school }}{% endif %}
diff --git a/_layouts/publication-entry.html b/_layouts/publication-entry.html
index fdea805..af79f4b 100644
--- a/_layouts/publication-entry.html
+++ b/_layouts/publication-entry.html
@@ -4,5 +4,5 @@
 </div>
 <p class="pub-title h4"><a href="{{ details }}">{{ entry.title }}</a></p>
 <p class="pub-authors">{% include publication-authors.html authors=entry.author_array %}</p>
-<p class="pub-venue">{% include publication-venue.html %}</p>
+<p class="pub-venue">{% include publication-venue.html entry=entry %}</p>
 
diff --git a/_layouts/publication.html b/_layouts/publication.html
index d9d9ddb..ad4462a 100644
--- a/_layouts/publication.html
+++ b/_layouts/publication.html
@@ -7,16 +7,16 @@ menu: false
     <div class="card">
       <div class="card-block">
         <h5 class="card-title">Venue</h5>
-        <p class="card-text">{{ page.entry.booktitle }}</p>
+        <p class="card-text">{% include publication-venue.html entry=page.entry %}</p>
         <h5 class="card-title">Publication Year</h5>
         <p class="card-text">{{ page.entry.year }}</p>
-        <h5 class="card-title">Keywords</h5>
-        <p class="card-text">{{ page.entry.keywords }}</p>
-        <h5 class="card-title">Identifiers</h5>
+        {% if page.entry.keywords %}<h5 class="card-title">Keywords</h5>
+        <p class="card-text">{{ page.entry.keywords }}</p>{% endif %}
+        {% if page.entry.doi or page.entry.isbn %}<h5 class="card-title">Identifiers</h5>
         <ul class="site-card-list">
-          <li>DOI: <a href="http://dx.doi.org/{{ page.entry.doi }}">{{ page.entry.doi }}</a></li>
-          <li>ISBN: {{ page.entry.isbn }}</li>
-        </ul>
+          {% if page.entry.doi %}<li>DOI: <a href="http://dx.doi.org/{{ page.entry.doi }}">{{ page.entry.doi }}</a></li>{% endif %}
+          {% if page.entry.isbn %}<li>ISBN: {{ page.entry.isbn }}</li>{% endif %}
+        </ul>{% endif %}
       </div>
     </div>
   </div>
@@ -32,11 +32,16 @@ menu: false
     {% endif %}
 
     <h3>Full Text</h3>
-    <p>{{ page.entry.numpages }} pages</p>
+    {% if page.entry.numpages %}<p>{{ page.entry.numpages }} pages</p>{% endif %}
+    {% if page.entry.doi or page.link %}
     <ul class="fa-ul">
       {% if page.link %}<li><a href="{{ page.link }}"><i class="fa fa-li fa-file-text-o"></i>Authors' Preprint</a></li>{% endif %}
-      <li><a href="http://dx.doi.org/{{ page.entry.doi }}"><i class="fa fa-li fa-external-link"></i>Published Edition</a></li>
+      {% if page.entry.doi %}<li><a href="http://dx.doi.org/{{ page.entry.doi }}"><i class="fa fa-li
+      fa-external-link"></i>Published Edition</a></li>{% endif %}
     </ul>
+    {% else %}
+    <p>Available on request</p>
+    {% endif %}
 
     {% comment %}
     <h3>Supplementary Material</h3>
-- 
GitLab