-
Notifications
You must be signed in to change notification settings - Fork 36
/
categories.ftl
39 lines (39 loc) · 1.41 KB
/
categories.ftl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<#include "template/layout.ftl">
<#macro categoriesTree categories>
<#list categories as category>
<li>
<a class="level is-marginless" href="${category.fullPath!}">
<span class="level-item">${category.name}</span>
<span class="level-item tag">${postCounts[category.id?c]!}</span>
</a>
<#if category.children?? && category.children?size gt 0>
<ul>
<@categoriesTree category.children/>
</ul>
</#if>
</li>
</#list>
</#macro>
<@layout title="分类 - ${blog_title!}" canonical="${categories_url!}">
<#assign postCounts = {}>
<@categoryTag method="list">
<#list categories as category>
<#assign postCounts += {category.id: category.postCount}>
</#list>
</@categoryTag>
<@categoryTag method="tree">
<#if categories?? && categories?size gt 0>
<div class="card card-content">
<div class="card-tab"><div>文章分类</div></div>
<ul class="menu-list">
<@categoriesTree categories/>
</ul>
</div>
<#else>
<div class="card card-empty">
<i class="ri-inbox-2-fill"></i>
还没有创建过分类,回<a href="${context!}">主页</a>看看吧
</div>
</#if>
</@categoryTag>
</@layout>