From e4d6d3eec6a75210f4eeb822da312f8870c935a8 Mon Sep 17 00:00:00 2001 From: Zequn Li Date: Wed, 2 Sep 2020 21:17:03 +0100 Subject: [PATCH] show tag in home article block --- _config.yml | 8 +++++++- layout/home-content.ejs | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index 44b3ca1..699a7b1 100644 --- a/_config.yml +++ b/_config.yml @@ -16,7 +16,7 @@ menu: Home: / Archives: /archives # Category: /category - Tags: /tags/ + # Tags: /tags/ # Links: /links # About: /about # ... @@ -106,3 +106,9 @@ magic: sidebar: enable: false position: right # values: left | right + +# Home page article block display settings +home_article: + tag: true # show tags in article block + tag_limit: 5 # max number of tags shown in article block + category: true # show category in article block \ No newline at end of file diff --git a/layout/home-content.ejs b/layout/home-content.ejs index b093e88..95cda57 100644 --- a/layout/home-content.ejs +++ b/layout/home-content.ejs @@ -24,6 +24,7 @@
<%= date(post.date, 'YYYY-MM-DD') %> <% if (theme.magic.enable === true) { %> + <% if (theme.home_article.category === true) { %>
    @@ -32,7 +33,20 @@ href="<%- url_for(category.path) %>"><%= category.name %> <% }); %>
-
+ + <% } %> + <% if (theme.home_article.tag === true) { %> + + +
    + <% post.tags.forEach((tag, i) => { + if (theme.home_article.tag_limit===0 | i+1<= theme.home_article.tag_limit) {%> +
  • <%= i === 0 ? '' : '| ' %><%= tag.name %>
  • + <% }}); %> +
+
+ <% } %> <% } %>
<% if (theme.magic.enable === false) { %>