show tag in home article block

This commit is contained in:
Zequn Li 2020-09-02 21:17:03 +01:00
parent 2f51c78b3b
commit e4d6d3eec6
2 changed files with 22 additions and 2 deletions

View File

@ -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

View File

@ -24,6 +24,7 @@
<div class="article-date">
<span><i class="fa fa-pencil-square-o"></i> <%= date(post.date, 'YYYY-MM-DD') %></span>
<% if (theme.magic.enable === true) { %>
<% if (theme.home_article.category === true) { %>
<span>
<i class="fa fa-folder"></i>
<ul>
@ -34,6 +35,19 @@
</ul>
</span>
<% } %>
<% if (theme.home_article.tag === true) { %>
<span>
<i class="fa fa-tags"></i>
<ul>
<% post.tags.forEach((tag, i) => {
if (theme.home_article.tag_limit===0 | i+1<= theme.home_article.tag_limit) {%>
<li><%= i === 0 ? '' : '| ' %><a
href="<%- url_for(tag.path) %>"><%= tag.name %></a></li>
<% }}); %>
</ul>
</span>
<% } %>
<% } %>
</div>
<% if (theme.magic.enable === false) { %>
<hr>