Forráskód Böngészése

Added a post.date condition in date.ejs

Signed-off-by: Xiaofeng QU <xiaofeng.qu.hk@ieee.org>
Xiaofeng QU 10 éve
szülő
commit
43a209bbd4
2 módosított fájl, 9 hozzáadás és 7 törlés
  1. 1 1
      layout/_partial/article.ejs
  2. 8 6
      layout/_partial/post/date.ejs

+ 1 - 1
layout/_partial/article.ejs

@@ -7,7 +7,7 @@
     <% if (post.link || post.title){ %>
       <header class="article-header">
         <%- partial('post/title', {class_name: 'article-title'}) %>
-        <div class="article-meta">
+	      <div class="article-meta">
           <%- partial('post/date', {class_name: 'article-date', date_format: null}) %>
           <%- partial('post/category') %>
         </div>

+ 8 - 6
layout/_partial/post/date.ejs

@@ -1,6 +1,8 @@
-<div class="<%= class_name %>">
-  <i class="fa fa-calendar"></i>
-  <a href="<%- url_for(post.path) %>">
-    <time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date, date_format) %></time>
-  </a>
-</div>
+<% if (post.date){ %>
+  <div class="<%= class_name %>">
+    <i class="fa fa-calendar"></i>
+    <a href="<%- url_for(post.path) %>">
+      <time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date, date_format) %></time>
+    </a>
+  </div>
+<% } %>