From e17c8354fcc5fdb3e7d66363e0acc79650577af3 Mon Sep 17 00:00:00 2001 From: Doge Date: Sun, 9 May 2021 17:48:44 +0800 Subject: Code enhancement --- layout/index.ejs | 198 ++++++++++++++++++++++++++---------------------------- layout/layout.ejs | 8 ++- layout/post.ejs | 114 +++++++++++++++---------------- 3 files changed, 157 insertions(+), 163 deletions(-) (limited to 'layout') diff --git a/layout/index.ejs b/layout/index.ejs index 7b91e49..cfb032a 100644 --- a/layout/index.ejs +++ b/layout/index.ejs @@ -1,117 +1,111 @@ -
-
-
- <% page.posts.each(function (post) { %> -
-
-
- - <% if (post.thumbnail) { %> -
-
- <% if (post.thumbnail) { %> - <% if (theme.lazyload === true) { %> - - <% } else { %> - - <% } %> - <% } %> -
-
+<% page.posts.each(function (post) { %> +
+
+
+ + <% if (post.thumbnail) { %> +
+
+ <% if (post.thumbnail) { %> + <% if (theme.lazyload === true) { %> + + <% } else { %> + + <% } %> <% } %> +
+
+ <% } %> -
- - -

- <%= post.title %> -

- - -
-
-
+
+ + +

+ <%= post.title %> +

- - <% if (post.podcast && theme.podcast) { %> -
- <% - const duration = post.podcast.duration; - const hour = Math.floor(duration / 3600); - const minute = Math.floor((duration / 60) % 60); - const second = Math.floor(duration % 60); - const viewstr = hour + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); - %> - <%- viewstr %> - <%- date(post.date, theme.timeformat) %> -
- <% } else { %> -
- - <%- date(post.date, theme.timeformat) %> - -
- <% } %> -
- - -
- <% if (post.tags) { %> -
- <% (post.tags).forEach(function(item) { %> - # <%= item.name %> - <% }); %> -
- <% } %> -
+ +
+
+
+ + <% if (post.podcast && theme.podcast) { %> +
+ <% + const duration = post.podcast.duration; + const hour = Math.floor(duration / 3600); + const minute = Math.floor((duration / 60) % 60); + const second = Math.floor(duration % 60); + const viewstr = hour + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); + %> + <%- viewstr %> + <%- date(post.date, theme.timeformat) %>
-
- - -
- <% if (post.excerpt) { %> -

<%- post.excerpt %>

- <% } else { %> -

<%- post.content %>

- <% } %> -
+ <% } else { %> +
+ + <%- date(post.date, theme.timeformat) %> + +
+ <% } %>
- -
+ + +
+ <% if (post.excerpt) { %> +

<%- post.excerpt %>

+ <% } else { %> +

<%- post.content %>

+ <% } %> +
- <% }); %> - - <% if (page.prev || page.next) { %> -
-
- -
+ - <% } %> + +
+
+
+<% }); %> + + +<% if (page.prev || page.next) { %> +
+
+
-
+<% } %> diff --git a/layout/layout.ejs b/layout/layout.ejs index 96d7f6a..d204ff4 100644 --- a/layout/layout.ejs +++ b/layout/layout.ejs @@ -4,7 +4,13 @@ <%- partial('_partial/header') %>
- <%- body %> +
+
+
+ <%- body %> +
+
+
<%- partial('_partial/footer') %> diff --git a/layout/post.ejs b/layout/post.ejs index 6b8ba67..9c04e82 100644 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -1,67 +1,61 @@ -
-
-
-
-
-
- <% if (page.thumbnail) { %> -
-
- <% if (theme.lazyload === true) { %> - - <% } else { %> - - <% } %> -
-
+
+
+
+ <% if (page.thumbnail) { %> +
+
+ <% if (theme.lazyload === true) { %> + + <% } else { %> + <% } %> -
-
-

- <%= page.title %> -

- <% if (page.podcast) { %> -
- - <% } %> -
- <%- page.content %> -
-
-
-
- <% if (page.tags) { %> -
- <% (page.tags).forEach(function(item) { %> - # <%= item.name %> - <% }); %> -
- <% } %> -
+
+
+ <% } %> +
+
+

+ <%= page.title %> +

+ <% if (page.podcast) { %> +
+ + <% } %> +
+ <%- page.content %> +
+
+
+
+ <% if (page.tags) { %> +
+ <% (page.tags).forEach(function(item) { %> + # <%= item.name %> + <% }); %>
-
-
+ <% } %> +
-
+
- \ No newline at end of file + \ No newline at end of file -- cgit v1.2.3