From 9067e2893b9f4cd531f9e49e84aba8c9e2106ad4 Mon Sep 17 00:00:00 2001 From: XPoet Date: Wed, 2 Sep 2020 17:49:53 +0800 Subject: [PATCH] feat: add post category page --- _config.yml | 2 +- layout/category-list.ejs | 14 +++++ layout/page.ejs | 5 +- source/css/layout/category-list.styl | 76 ++++++++++++++++++++++++++++ source/css/style.styl | 1 + 5 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 layout/category-list.ejs create mode 100644 source/css/layout/category-list.styl diff --git a/_config.yml b/_config.yml index 483ee60..9ba2fe2 100644 --- a/_config.yml +++ b/_config.yml @@ -16,8 +16,8 @@ menu: Home: / Archives: /archives # Category: /category - # About: /about # Links: /links + # About: /about # ... # RSS diff --git a/layout/category-list.ejs b/layout/category-list.ejs new file mode 100644 index 0000000..a9ba032 --- /dev/null +++ b/layout/category-list.ejs @@ -0,0 +1,14 @@ +
+
+
+ <%- list_categories(site.categories, { + class: 'all-category' + }) %> +
+
+ <% if (page.comments) { %> + <%- partial('_partial/comments/comment') %> + <% } %> +
+
+
diff --git a/layout/page.ejs b/layout/page.ejs index bd0e859..9064646 100644 --- a/layout/page.ejs +++ b/layout/page.ejs @@ -23,6 +23,9 @@ <% } else if (is_tag()) { %> <%- partial('tag-content') %> + <% } else if (page.title == 'category') { %> + <%- partial('category-list') %> + <% } else if (page.title == 'about') { %> <%- partial('about') %> @@ -62,4 +65,4 @@ <% if (theme.local_search.enable) { %> <%- partial('_partial/local-search') %> -<% } %> \ No newline at end of file +<% } %> diff --git a/source/css/layout/category-list.styl b/source/css/layout/category-list.styl new file mode 100644 index 0000000..bdc1dba --- /dev/null +++ b/source/css/layout/category-list.styl @@ -0,0 +1,76 @@ +@require "./common/magic-theme.styl"; + +.category-list-container { + + background: var(--background-color); + + magic-container(1.005, 1.01, 30px); + + +ils-tablet() { + magic-container(1.001, 1.005, 20px); + } + + .category-list-content { + + .all-category-list { + + font-size: 1.18em; + + +ils-tablet() { + font-size: 1.12em; + } + + + li.all-category-list-item { + + margin-bottom: 15px; + + &:last-child { + margin-bottom: 0; + } + + a.all-category-list-link { + + } + + span.all-category-list-count { + + float: right; + + &::before { + content: '('; + } + + &::after { + content: ')'; + } + + } + + + ul.all-category-list-child { + + margin-left: 10px; + margin-top: 15px; + + li { + + &::before { + content: '· '; + } + + margin-bottom: 10px; + + &:last-child { + margin-bottom: 0; + } + + } + } + } + + + } + + } +} diff --git a/source/css/style.styl b/source/css/style.styl index cc2176c..6f9b37e 100644 --- a/source/css/style.styl +++ b/source/css/style.styl @@ -12,6 +12,7 @@ @import "layout/_partial/footer.styl" @import "layout/_partial/paginator.styl" @import "layout/about.styl" +@import "layout/category-list.styl" @import "layout/links.styl" @import "layout/_partial/article-meta-info.styl" @import "layout/home-content.styl"