Ikeq ChengIkeq Cheng

The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts.

Inside 主题配置 - Content

Feb 1, 2019

Overview

page:
  • toc
  • reward
  • copyright
post:
  • per_page
  • toc
  • reward
  • copyright
  • reading_time
archive:
  • per_page
tag:
  • per_page
category:
  • per_page
search:
  • fab
  • page
  • adapter
toc:
  • depth
  • index
reward:
  • text
  • methods[]:
    • name
    • qrcode
    • url
    • text
copyright:
  • global
  • author
  • link
  • license
  • published
  • updated
  • custom

page

page 相关设置。

1
2
3
4
5
6
7
8
9
page:
# 显示目录,默认启用,设置为 `false` 可禁用
toc: false

# 显示打赏,默认禁用,设置为 `true` 可启用
reward: true

# 显示版权声明,默认禁用,设置为 `true` 可启用
copyright: true

post

post 相关设置。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
page:
# 首页文章列表的分页大小,缺省值 `10`
per_page: 10
# 显示阅读时间,缺省值 `true`
reading_time: false # 禁用
reading_time:
# 每分钟阅读字数
wpm: 200
# 展示文案
# 差值: `:words` 字数 `:minutes` 字数 / wpm
text: ":words words in :minutes min"

# 以下参数设置与 page 一致
toc: false
reward: true
copyright: true

archive, tag, category

1
2
3
4
5
6
7
8
9
10
11
archive:
# 归档页分页大小,缺省值 `10`
per_page: 10

tag:
# 标签页分页大小,缺省值 `10`
per_page: 10

category:
# 分类页分页大小,缺省值 `10`
per_page: 10

toc

目录设置,默认全局启用。

1
2
3
4
5
toc:
# 最多显示几层目录,最多 4 层,缺省值 `3`
depth:
# 是否显示标号,如 1.1、1.2,默认显示,设置为 false 可隐藏。
index: false

设置为 false 可全局禁用,如:

1
toc: false

可单独禁用 post 或 page 的目录,详见 page.tocpost.toc

reward

打赏设置,默认禁用。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
reward:
# 显示一句文案
text: Buy me a cup of coffee ☕.

# 支付方式列表,注意是数组
methods:
-
# wechat、alipay、paypal、bitcoin 对应四种不同的图标和配色
# 此外的任何自定义名称,都需要在语言文件内增加相应的语言,
# 同时配色与 appearance.accent_color 一致
name:
# 二维码地址
qrcode:
# 显示一个链接
url:
# 若设置了 url,则此值会显示为链接的文本,否则为一段普通文本
text:
# 选中时的颜色
color:

# qrcode、url 和 text 必须至少设置一项

版权声明,默认禁用。

1
2
3
4
5
6
7
8
9
10
11
12
13
copyright:
# 显示作者,设置为 false 可隐藏。
author: false
# 显示文章链接,设置为 false 可隐藏。
link: false
# 版权声明
license: Attribution-NonCommercial-NoDerivatives 4.0 International<br>(<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noopener" target="_blank">CC BY-NC-ND 4.0</a>)
# 显示发表日期,默认不显示,设置为 true 可显示。
published: true
# 显示修改日期,默认不显示,设置为 true 可显示。
updated: true
# 禁用以上设置,显示自定义信息
custom: 不许转载😡!!!

可通过改变项的先后顺序来自定义排序。

搜索,默认禁用。

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
search:
# 在页面右下角的 FAB 按钮里显示快捷搜索入口
fab: true

# 额外生成 search 页面,可配置在 sidebar 导航,如 `Search: /search`
page: true

# 以上两个入口必须至少设置一个,否则视为无效配置

# 本地搜索,即生成本地 json 文件
adapter:
# json 数据的范围,数组
range:
- post
- page

# json 数据的条目限制
# 假如 `limit:1000`,同时有 800 篇 post,800 篇 page,则最终生成的数据包含:
# 800 篇 post,200 篇 page
# 缺省值 `10000`
limit: 10000

# 搜索结果分页大小,缺省值 `10`
per_page: 5

# 自定义搜索 API
adapter:
# 搜索结果分页大小,缺省值 `10`
per_page: 5
# 显示 LOGO 图片,可选
logo: //cdn.worldvectorlogo.com/logos/algolia.svg
# 此配置项为构造完整的请求对象
request:
# 接口 URL
url: https://APPLICATION_ID-dsn.algolia.net/1/indexes/INDEX/query

# GET 或 POST,不区分大小写,缺省值 `GET`
method: post

# 请求参数,格式视 Content-Type 而定,支持的字符串插值有:
# 搜索的字符串 `:query`
# 分页大小 `:per_page`
# 当前页 `:current`
body: '{"query":":query","hitsPerPage":":per_page","page":":current"}'

# 请求头
headers:
X-Algolia-API-Key: API_KEY
X-Algolia-Application-Id: APPLICATION_ID
Content-Type: application/json; charset=UTF-8

# 用于统一数据格式,例如有如下返回结果
# {
# "hits": [
# {
# "title": "Inside Theme Showcase",
# "date": "2018-09-05T06:28:24.000Z",
# "_snippetResult": {
# "title": { "value": "" },
# "content": { "value": "" }
# }
# }
# ],
# "nbHits": 10,
# "page": 0,
# "nbPages": 1,
# "processingTimeMS": 5
# }
# 则设置
keys:
data: hits
current: page
total: nbPage
hits: nbHits
time: processingTimeMS
# title 对应具体某一条的标题字段
title: _snippetResult.title.value
# title 对应具体某一条的内容字段
content: _snippetResult.content.value

有关集成 algolia 的详细说明可参考这里 Inside 主题集成 Algolia 搜索

See also

Buy me a cup of milk 🥛.