diff --git a/layout/common/archive-post.ejs b/layout/common/archive-post.ejs index b172eb5..c9353eb 100644 --- a/layout/common/archive-post.ejs +++ b/layout/common/archive-post.ejs @@ -1,11 +1,42 @@ - \ No newline at end of file +<% if (is_archive()) { %> + +
+ + + <% let last; %> + <% site.posts.each(function(post, i){ %> + <% let year = post.date.year(); %> + <% if (last != year) { %> + <% if (last != null){ %> +
+ <% } %> + <% last = year; %> +
+
+ <%= year %> +
+
+ <% } %> +
+ <%= post.title %> + +
+ <% }) %> + <% if (site.posts.length){ %> +
+
+ <% } %> + + + + +<% } %> + + + + + + + + diff --git a/layout/page.ejs b/layout/page.ejs index 7026f71..bfdb9b2 100644 --- a/layout/page.ejs +++ b/layout/page.ejs @@ -1,4 +1,4 @@ - +
<%- partial('left-side') %> @@ -6,4 +6,4 @@
<%- partial('right-side') %>
-
+
\ No newline at end of file diff --git a/scripts/helper.js b/scripts/helper.js new file mode 100644 index 0000000..a13c273 --- /dev/null +++ b/scripts/helper.js @@ -0,0 +1,9 @@ +/** + * Hexo 扩展:辅助函数(Helper) + * 补充复杂的业务逻辑 + * https://hexo.io/zh-cn/api/helper.html + * 用法:<%= helper_test('xxx') %> + */ +hexo.extend.helper.register('helper_test', function (character) { + return character + '😁'; +}); \ No newline at end of file diff --git a/source/css/common/archive-post.styl b/source/css/common/archive-post.styl new file mode 100644 index 0000000..77fd3af --- /dev/null +++ b/source/css/common/archive-post.styl @@ -0,0 +1,36 @@ +.archive-container { + background: #fff + padding 30px + + .archives-wrap { + margin-bottom 20px + + .archive-year { + font-size: 24px; + color: #666; + font-weight: 600; + } + + .archive-article-list { + + .archive-article-item { + margin 10px 0 + font-size 16px + + a.archive-article-title { + color #8f8f8f + + &:hover { + color: #4786D6; + } + } + + .archive-article-date { + float right + } + } + } + } +} + + diff --git a/source/css/common/site-info.styl b/source/css/common/site-info.styl index 2302ce8..6729106 100644 --- a/source/css/common/site-info.styl +++ b/source/css/common/site-info.styl @@ -3,7 +3,7 @@ .avatar { padding 2px - border-radius 50% + border-radius 10% border 1px solid #ddd width: 50%; } diff --git a/source/css/style.styl b/source/css/style.styl index f0a60cd..ecc3248 100644 --- a/source/css/style.styl +++ b/source/css/style.styl @@ -7,6 +7,7 @@ @import "footer.styl" @import "common/nav.styl" @import "common/article-post.styl" +@import "common/archive-post.styl" @import "common/site-info.styl" .header { diff --git a/source/js/main.js b/source/js/main.js index 97621a0..411c975 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -5,4 +5,10 @@ console.log('this is main.js'); e.classList.add('btn'); e.setAttribute('role', 'navigation'); }); -})(); \ No newline at end of file +})(); + +// app.locals.structureArchiveList = function (posts) { +// posts.forEach(post => { +// console.log('post: ', post); +// }); +// }; \ No newline at end of file diff --git a/source/js/utils.js b/source/js/utils.js index c201c97..9173cc7 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -1,3 +1,4 @@ export const addClass = (element, className) => { element.classList.add(className) -}; \ No newline at end of file +}; +