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 ++++++++++++++--------------- source/css/style.css | 12 +++- 4 files changed, 168 insertions(+), 164 deletions(-) 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 diff --git a/source/css/style.css b/source/css/style.css index 5596590..009e27b 100644 --- a/source/css/style.css +++ b/source/css/style.css @@ -22,7 +22,17 @@ pre { } .post-entry { - margin-bottom: 3rem !important; + margin-bottom: 1.5rem !important; + margin-top: 1.5rem !important; + transition: box-shadow 0.1s; +} + +.post-entry:hover { + box-shadow: 0 1em 2em -0.125em rgb(10 10 10 / 10%), 0 0 0 1px rgb(10 10 10 / 2%); +} + +.post-card { + margin-top: 1.5rem !important; } .pagination-bar { -- cgit v1.2.3