summaryrefslogtreecommitdiff
path: root/layout/index.ejs
diff options
context:
space:
mode:
authorDoge <[email protected]>2021-05-06 13:14:51 +0800
committerDoge <[email protected]>2021-05-06 13:14:51 +0800
commit1e2b85ff51e0458878b77c9a21cf492cf120b02c (patch)
tree313164378100306811c69179eb166d372f8319a6 /layout/index.ejs
parent14f00dc7134dfb712bfb09e9b341f709168bae56 (diff)
downloadchromate-1e2b85ff51e0458878b77c9a21cf492cf120b02c.tar.gz
chromate-1e2b85ff51e0458878b77c9a21cf492cf120b02c.tar.bz2
chromate-1e2b85ff51e0458878b77c9a21cf492cf120b02c.zip
Making progress
Diffstat (limited to 'layout/index.ejs')
-rw-r--r--layout/index.ejs35
1 files changed, 33 insertions, 2 deletions
diff --git a/layout/index.ejs b/layout/index.ejs
index 9d0d7bd..1857e73 100644
--- a/layout/index.ejs
+++ b/layout/index.ejs
@@ -1,19 +1,50 @@
<section class="posts">
<% page.posts.each(function (post) { %>
<article class="post">
+ <!-- Post thumbnail with lazayload support -->
<% if (post.thumbnail) { %>
- <% if (theme.lazyload) { %>
+ <% if (theme.lazyload === true) { %>
<div class="post-thumbnail lazy" data-bg="<%= post.thumbnail %>"></div>
<% } else { %>
<div class="post-thumbnail" style="background-image: url('<%= post.thumbnail %>');"></div>
<% } %>
<% } %>
- <h1 class="post-title"><%= post.title %></h1>
+
+ <!-- Post title and excerpt -->
+ <h1 class="post-title">
+ <a class="post-link" href="<%- url_for(post.path) %>">
+ <%= post.title %>
+ </a>
+ </h1>
<% if (post.excerpt) { %>
<div class="post-excerpt"><%- post.excerpt %></div>
<% } else { %>
<div class="post-content"><%- post.content %></div>
<% } %>
+
+ <!-- Post meta -->
+ <div class="post-meta">
+ <% if (post.podcast && theme.podcast && post.duration) { %>
+ <%
+ const hour = Math.floor(post.duration / 3600);
+ const minute = Math.floor((post.duration / 60) % 60);
+ const second = Math.floor(post.duration % 60);
+ const duration = hour + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0');
+ %>
+ <div class="post-duration"><%- duration %></div>
+ <% } %>
+ <div class="post-time">
+ <%- date(post.date, "MMM, D YYYY") %>
+ </div>
+ <% if (post.tags) { %>
+ <div class="post-tags">
+ <% (post.tags).forEach(function(item) { %>
+ <span class="post-tag"><%= item.name %></span>
+ <% }); %>
+ </div>
+ <% } %>
+ </div>
+
</article>
<% }) %>
</section> \ No newline at end of file