Tags v0.3.4
in this version, we add Zset , Set to cache lib support sync safe set and sorted set.
by these improvements, we have added pagination to the article list, add recommendation to the article detail and we also add a limit to the feeds.
thanks for @yddeng and @deckarep
- you can easily use the automatic pagination like this.
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="UTF-8" />
5 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 <title>Document</title>
8 </head>
9 <body>
10 <main>
11 <!-- 总数为0,不显示 -->
12 {{if ne .Page.Total 0}}
13 <ul>
14 <!-- 首页 -->
15 <li>
16 <a href="{{.Page.Path}}">首页</a>
17 </li>
18
19 <!-- 上一页,为0不显示 -->
20 {{if ne .Page.Pre 0}}
21 <li>
22 <a href="{{.Page.Path}}page/{{.Page.Pre}}/">上一页</a>
23 </li>
24 {{end}}
25
26 <!-- 定义局部变量 -->
27 {{$Path :=.Page.Path}}
28
29 <!-- 循环快捷分页列表 当前页-5 ~ 当前页+5 -->
30 {{range .Page.Data}}
31 <li>
32 <a href="{{$Path}}page/{{.}}/">{{add . 1}}</a>
33 </li>
34 {{end}}
35
36 <!-- 下一页,为0不显示 -->
37 {{if ne .Page.Next 0}}
38 <li>
39 <a href="{{.Page.Path}}page/{{.Page.Next}}/">下一页</a>
40 </li>
41 {{end}}
42
43 <!-- 尾页 -->
44 <li>
45 <a href="{{.Page.Path}}page/{{.Page.Total}}/">尾页</a>
46 </li>
47 </ul>
48 {{end}}
49 </main>
50 </body>
51</html>
52{{end}}
-
only can be use for artilce catalog, such as catalog, archive, category, tag
-
you can set the page size in config.toml
site.size
, default number is 10.
- you can easily use the automatic recommendation like this.
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="UTF-8" />
5 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 <title>Document</title>
8 </head>
9 <body>
10 <main>
11 <ul>
12 <!-- 循环推荐 -->
13 {{range .Message.Top}}
14 <li>
15 <!-- 缩略图 -->
16 <a href="{{toLower .Name}}">
17 <img class="w-full lazy" src="/assets/img/loading.gif" data-src="{{.Meta.thumb}}" alt="" />
18 </a>
19
20 <!-- 名称 -->
21 <a href="{{toLower .Name}}"> {{.Meta.title}} </a>
22
23 <!-- 描述 -->
24 <p>{{.Meta.description}}</p>
25
26 <!-- 日期 -->
27 <span> {{.Meta.date}}</span>
28
29 <!-- 分类 -->
30 {{if .Lang.State}}
31 <a href="/{{.Lang.Content}}/category/{{toLower .Meta.category}}/"> {{.Meta.category}} </a>
32 {{else}}
33 <a href="/category/{{toLower .Meta.category}}/"> {{.Meta.category}} </a>
34 {{ end }}
35 </li>
36 {{end}}
37 </ul>
38 </main>
39 </body>
40</html>
41{{end}}
-
only can be use for artilce details, not suppot document, page and others.
-
you can set the recommendation amount in config.toml
site.amount
, default number is 3.
-
you can set the feeds limit in config.toml
site.feeds.limit
, default number is 100. -
you can set the i18n customize template in config.toml
i18n.name
, default value isindex
ADD
-
add article pagination to article catalog
-
add article content top
-
add feeds config limit
-
add i18n customize template