hexo-theme-ayeria 1.9.10 → 1.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENSE +37 -37
  2. package/README.en.md +560 -560
  3. package/README.md +560 -560
  4. package/_config.yml +271 -271
  5. package/_scaffolds/post.md +8 -8
  6. package/index.js +11 -2
  7. package/languages/de.yml +39 -39
  8. package/languages/default.yml +40 -39
  9. package/languages/en.yml +40 -39
  10. package/languages/es.yml +39 -39
  11. package/languages/fr.yml +39 -39
  12. package/languages/ja.yml +39 -39
  13. package/languages/ko.yml +39 -39
  14. package/languages/nl.yml +39 -39
  15. package/languages/no.yml +39 -39
  16. package/languages/pt.yml +39 -39
  17. package/languages/ru.yml +39 -39
  18. package/languages/vi.yml +39 -39
  19. package/languages/zh-CN.yml +40 -39
  20. package/languages/zh-TW.yml +40 -39
  21. package/layout/_partial/ads.ejs +8 -8
  22. package/layout/_partial/after-footer.ejs +84 -84
  23. package/layout/_partial/archive-post.ejs +13 -13
  24. package/layout/_partial/archive.ejs +61 -61
  25. package/layout/_partial/article.ejs +94 -94
  26. package/layout/_partial/ayeria.ejs +53 -53
  27. package/layout/_partial/baidu-analytics.ejs +11 -11
  28. package/layout/_partial/broadcast.ejs +19 -19
  29. package/layout/_partial/float-btns.ejs +7 -7
  30. package/layout/_partial/footer.ejs +61 -61
  31. package/layout/_partial/google-analytics.ejs +10 -10
  32. package/layout/_partial/head.ejs +64 -68
  33. package/layout/_partial/katex.ejs +21 -21
  34. package/layout/_partial/lock.ejs +37 -37
  35. package/layout/_partial/mathjax.ejs +18 -18
  36. package/layout/_partial/modal.ejs +70 -76
  37. package/layout/_partial/music.ejs +15 -15
  38. package/layout/_partial/post/albums.ejs +16 -16
  39. package/layout/_partial/post/author.ejs +7 -7
  40. package/layout/_partial/post/busuanzi.ejs +4 -4
  41. package/layout/_partial/post/category.ejs +9 -9
  42. package/layout/_partial/post/clipboard.ejs +54 -54
  43. package/layout/_partial/post/date.ejs +2 -2
  44. package/layout/_partial/post/gallery.ejs +15 -15
  45. package/layout/_partial/post/giscus.ejs +40 -40
  46. package/layout/_partial/post/gitalk.ejs +12 -12
  47. package/layout/_partial/post/justifiedGallery.ejs +8 -8
  48. package/layout/_partial/post/nav.ejs +22 -22
  49. package/layout/_partial/post/search.ejs +3 -3
  50. package/layout/_partial/post/share.ejs +53 -53
  51. package/layout/_partial/post/tag.ejs +5 -5
  52. package/layout/_partial/post/title.ejs +16 -16
  53. package/layout/_partial/post/tocbot.ejs +6 -6
  54. package/layout/_partial/post/topping.ejs +2 -2
  55. package/layout/_partial/post/twikoo.ejs +7 -7
  56. package/layout/_partial/post/valine.ejs +48 -48
  57. package/layout/_partial/post/word.ejs +19 -19
  58. package/layout/_partial/sidebar.ejs +48 -33
  59. package/layout/_partial/viewer.ejs +105 -105
  60. package/layout/categories.ejs +8 -8
  61. package/layout/friends.ejs +19 -19
  62. package/layout/index.ejs +4 -4
  63. package/layout/layout.ejs +35 -30
  64. package/layout/page.ejs +2 -2
  65. package/layout/plain-page.ejs +4 -4
  66. package/layout/post.ejs +2 -2
  67. package/layout/tags.ejs +88 -88
  68. package/package.json +39 -39
  69. package/scripts/default_config.js +6 -6
  70. package/scripts/events/index.js +11 -11
  71. package/scripts/events/lib/hello.js +38 -38
  72. package/scripts/events/lib/merge-configs.js +28 -28
  73. package/scripts/filters/index.js +13 -13
  74. package/scripts/filters/meta_generator.js +17 -17
  75. package/scripts/helpers/ayeria-plus-vendors.js +9 -9
  76. package/scripts/helpers/category-tree.js +90 -90
  77. package/scripts/helpers/wordcount.js +39 -39
  78. package/scripts/lib/core.js +25 -25
  79. package/scripts/utils/join-path.js +12 -12
  80. package/scripts/utils/object.js +31 -31
  81. package/source/404.html +187 -187
  82. package/source/css/ayeria-layout.styl +48 -48
  83. package/source/css/clipboard.styl +37 -37
  84. package/source/css/custom.styl +17 -17
  85. package/source/css/fonts/remixicon.css +1816 -1816
  86. package/source/css/fonts/remixicon.svg +5329 -5329
  87. package/source/data/random-sentences.txt +2629 -141
  88. package/source/dist/main.css +1 -1
  89. package/source/dist/main.js +1 -1
  90. package/source/js/clickBoom1.js +152 -152
  91. package/source/js/clickBoom2.js +180 -180
  92. package/source/js/jquery-3.6.0.min.js +2 -2
  93. package/source/js/lazyload.min.js +7 -7
  94. package/source/js/search.js +126 -126
  95. package/source/js/random-sentences.js +0 -166
package/README.md CHANGED
@@ -1,560 +1,560 @@
1
- # hexo-theme-ayeria
2
-
3
- [![npm version](https://img.shields.io/npm/v/hexo-theme-ayeria.svg)](https://www.npmjs.com/package/hexo-theme-ayeria)
4
- [![npm downloads](https://img.shields.io/npm/dm/hexo-theme-ayeria.svg)](https://www.npmjs.com/package/hexo-theme-ayeria)
5
-
6
- > **English / 英文文档:** [**README.en.md — 完整英文说明(English README)**](README.en.md)
7
-
8
- ![Ayeria 主题效果预览](screenshots/Ayeria.png)
9
-
10
- 一个干净且优雅的 Hexo 博客主题,基于 [Ayer](https://github.com/Shen-Yu/hexo-theme-ayer) 深度定制。
11
-
12
- Ayeria —— 源自 Ayer(马来语"水"、西班牙语"昨日"),独立维护的衍生主题。原作者:[Eric-Shen](https://github.com/Shen-Yu)。
13
-
14
- ## 功能特性
15
-
16
- - 全屏封面 + typed.js 打字动效
17
- - 深色模式一键切换
18
- - 本地搜索(XML 索引 + 前端全文检索)
19
- - 四种评论系统(Valine / Gitalk / Twikoo / Giscus)
20
- - 数学公式(MathJax / KaTeX)+ Mermaid 流程图
21
- - 打赏功能(数据驱动,支持多渠道、子渠道、品牌色、图标)
22
- - 文章 TOC 目录、字数统计、代码复制、图片放大、版权声明
23
- - 随机句子(本地 txt 文件或内置句子库,防重复队列)
24
- - 告示板(自定义文字 / 一言 API)
25
- - 访问量统计(不蒜子 / 友盟 CNZZ / Google Analytics / 百度统计)
26
- - 网易云音乐嵌入
27
- - 鼠标特效(自定义光标、点击爱心/爆炸/粒子)
28
- - Canvas 动态背景
29
- - 加密锁屏(SweetAlert2)
30
- - 广告位、ICP/公安备案信息
31
- - 14 种语言支持
32
- - 自定义 CSS(`source/css/custom.styl`)
33
- - Rollup 构建流水线
34
-
35
- ## 安装
36
-
37
- ### 方式一:npm(Hexo >= 5.0)
38
-
39
- ```bash
40
- npm i hexo-theme-ayeria -S
41
- ```
42
-
43
- ### 方式二:Git
44
-
45
- ```bash
46
- git clone https://github.com/KaleidScoper/hexo-theme-ayeria.git themes/ayeria
47
- ```
48
-
49
- 在站点根目录的 `_config.yml` 中启用主题:
50
-
51
- ```yml
52
- theme: ayeria
53
- ```
54
-
55
- ## 配置
56
-
57
- 主题自带默认配置文件 `themes/ayeria/_config.yml`。你**不应直接修改**这个文件,而是在站点根目录创建 `_config.ayeria.yml`,只填写需要覆盖的选项。Hexo 5+ 会自动将其与主题默认配置合并。
58
-
59
- 下文列出所有可配置项。
60
-
61
- ### 侧边栏菜单
62
-
63
- ```yml
64
- menu:
65
- 主页: /
66
- 全部文章: /archives
67
- 文章分类: /categories
68
- 全部标签: /tags
69
- 友情链接: /friends
70
- 关于本站: /about
71
- ```
72
-
73
- 添加的页面需要先用 `hexo new page <name>` 创建(详见下方[页面创建](#页面创建))。
74
-
75
- ### 封面
76
-
77
- 全屏背景图封面,可选叠加 Logo。主题内附一张示例封面图 `source/images/cover2.webp`。
78
-
79
- ```yml
80
- cover:
81
- enable: true
82
- path: /images/cover.jpg # 背景图路径(放在主题或站点的 source/images/ 下)
83
- logo: false # 封面 Logo 图片路径,不需要设为 false
84
- ```
85
-
86
- ### 打字动效
87
-
88
- 封面上基于 [typed.js](https://github.com/mattboldt/typed.js) 的文字滚动效果。
89
-
90
- ```yml
91
- subtitle:
92
- enable: true
93
- text: 第一行文字
94
- text2: 第二行文字 # 可留空
95
- text3: 第三行文字 # 最多三行
96
- startDelay: 1000
97
- typeSpeed: 200
98
- loop: true
99
- backSpeed: 100
100
- showCursor: true
101
- ```
102
-
103
- ### 网站图标与 Logo
104
-
105
- ```yml
106
- favicon: /favicon.svg # 浏览器标签页图标
107
- logo: /favicon.svg # 侧边栏顶部 Logo
108
- ```
109
-
110
- 请将你自己的 favicon 放到站点 `source/` 或主题 `source/` 目录下。
111
-
112
- ### 进度条
113
-
114
- 页面顶部加载进度条(Pace.js CDN)。
115
-
116
- ```yml
117
- progressBar: true
118
- ```
119
-
120
- ### 告示板
121
-
122
- ```yml
123
- broadcast:
124
- enable: true
125
- type: 2 # 1: 自定义文字;2: 一言 API (hitokoto.cn)
126
- text: 自定义告示内容 # type 为 1 时有效
127
- ```
128
-
129
- ### 随机句子
130
-
131
- 页脚展示随机句子,支持本地 txt 文件(`source/data/random-sentences.txt`)或内置句子库。具有防重复队列机制。
132
-
133
- ```yml
134
- random_sentences:
135
- enable: true
136
- use_local_file: true # true: 读取 source/data/random-sentences.txt;false: 内置句子库
137
- queue_size: 5 # 防重复队列大小,建议为句子总数的 1/4 ~ 1/3
138
- ```
139
-
140
- 本地 txt 文件格式:每行一句,`#` 开头为注释,双空格会转换为换行,空行自动忽略。
141
-
142
- ### 文章功能
143
-
144
- ```yml
145
- excerpt_link: 显示更多... # 截断按钮文字(在文章中插入 <!--more--> 标记截断位置)
146
- excerpt_all: false # true: 首页只显示文章归档,不展示正文
147
-
148
- copy_btn: true # 代码复制按钮
149
- share_enable: true # 文章分享按钮
150
- share_china: true # 使用国内社交平台
151
- share_text: 分享
152
-
153
- toc: true # 文章目录(单篇可通过 front-matter no_toc: true 关闭)
154
- image_viewer: true # 图片点击放大
155
- ```
156
-
157
- ### 分页文字
158
-
159
- ```yml
160
- nav_text:
161
- page_prev: 上一页
162
- page_next: 下一页
163
- post_prev: 上一篇
164
- post_next: 下一篇
165
- ```
166
-
167
- ### 字数统计
168
-
169
- 需要安装插件:`npm i hexo-wordcount -S`
170
-
171
- ```yml
172
- word_count:
173
- enable: true
174
- only_article_visit: true # 只在文章详情页显示(不在首页显示)
175
- ```
176
-
177
- 单篇文章可通过 `no_word_count: true` 关闭。
178
-
179
- ### 打赏
180
-
181
- ```yml
182
- reward_type: 1 # 0: 关闭;1: front-matter 中 reward:true 才显示;2: 所有文章
183
- reward_wording: "如果这篇文章对你有帮助,可以请我喝杯茶"
184
-
185
- reward:
186
- button_text: "赏杯茶" # 留空则使用语言包默认值
187
- channels:
188
- - name: "支付宝"
189
- icon: "ri-alipay-line" # RemixIcon 类名
190
- color: "#1677FF" # 品牌主题色
191
- qrcode: "/images/reward/alipay.jpg"
192
- description: "支付宝扫一扫"
193
-
194
- - name: "微信支付"
195
- icon: "ri-wechat-pay-line"
196
- color: "#07C160"
197
- qrcode: "/images/reward/wechat.jpg"
198
- description: "微信扫一扫"
199
-
200
- - name: "USDT" # 支持子渠道
201
- icon: "ri-coin-line"
202
- color: "#50AF95"
203
- description: "选择网络后扫码转账"
204
- children:
205
- - name: "TRC-20"
206
- badge: "推荐"
207
- qrcode: "/images/reward/USDT-TRC20.webp"
208
- description: "Tron 链 · 手续费最低"
209
- - name: "ERC-20"
210
- qrcode: "/images/reward/USDT-ERC20.webp"
211
- description: "以太坊主网"
212
- ```
213
-
214
- 二维码图片建议放在站点 `source/images/reward/` 目录下。单篇文章可通过 `no_reward: true` 强制关闭。
215
-
216
- ### 版权声明
217
-
218
- ```yml
219
- copyright_type: 0 # 0: 关闭;1: front-matter 中 copyright:true 才显示;2: 所有文章
220
- ```
221
-
222
- ### 搜索
223
-
224
- 需要安装插件:`npm i hexo-generator-searchdb -S`
225
-
226
- 并在站点 `_config.yml` 中添加:
227
-
228
- ```yml
229
- search:
230
- path: search.xml
231
- field: post
232
- format: html
233
- ```
234
-
235
- 然后启用主题搜索:
236
-
237
- ```yml
238
- search: true
239
- ```
240
-
241
- ### RSS 订阅
242
-
243
- 需要安装插件:`npm i hexo-generator-feed -S`
244
-
245
- 并在站点 `_config.yml` 中配置 feed。然后在主题配置中:
246
-
247
- ```yml
248
- rss: /atom.xml # 留空则不在侧边栏显示 RSS 入口
249
- ```
250
-
251
- ### 深色模式
252
-
253
- ```yml
254
- darkmode: true # 侧边栏显示深色模式切换按钮
255
- ```
256
-
257
- ### 视觉效果
258
-
259
- ```yml
260
- canvas_bg: 0 # 动态背景:0-关闭,1-动态线条(跟随鼠标)
261
-
262
- mouse:
263
- enable: false
264
- path: /images/mouse.cur # 自定义鼠标样式文件路径
265
-
266
- click_effect: 0 # 鼠标点击效果:0-关闭,1-爱心,2-爆炸烟花,3-粒子烟花
267
- ```
268
-
269
- ### 布局宽度
270
-
271
- ```yml
272
- layout:
273
- article_width: 80rem
274
- sidebar_width: 8rem
275
- ```
276
-
277
- ### GitHub Ribbon
278
-
279
- 封面右上角 Fork-me 图标。可替换 `source/images/` 下的 forkme 图片自定义样式。
280
-
281
- ```yml
282
- github:
283
- enable: false
284
- url: https://github.com/your-username/your-repo
285
- ```
286
-
287
- ### 音乐播放器
288
-
289
- 嵌入网易云音乐。
290
-
291
- ```yml
292
- music:
293
- enable: false
294
- type: 1 # 1: 小尺寸;2: 大尺寸
295
- id: 22707008 # 网易云音乐 ID
296
- autoPlay: true
297
- ```
298
-
299
- ### 统计分析
300
-
301
- ```yml
302
- busuanzi:
303
- enable: true # 不蒜子页面访问量统计
304
-
305
- cnzz:
306
- enable: false
307
- url: # 友盟 CNZZ 的 js 代码 src 链接
308
-
309
- google_analytics: "" # Google Analytics 追踪 ID
310
- baidu_analytics: "" # 百度统计追踪 ID
311
- ```
312
-
313
- ### 数学公式
314
-
315
- MathJax 和 KaTeX 二选一。使用 KaTeX 需要更换渲染器:
316
-
317
- ```bash
318
- npm un hexo-renderer-marked -S && npm i hexo-renderer-markdown-it-katex -S
319
- ```
320
-
321
- ```yml
322
- mathjax: false
323
-
324
- katex:
325
- enable: false
326
- allpost: true # false: 仅 front-matter 中 math:true 的文章开启
327
- copy_tex: false
328
- ```
329
-
330
- ### Mermaid 流程图
331
-
332
- ```yml
333
- mermaid:
334
- enable: false
335
- cdn: https://cdn.staticfile.org/mermaid/8.14.0/mermaid.min.js
336
- theme: forest
337
- ```
338
-
339
- ### 网站信息
340
-
341
- ```yml
342
- since: 2019 # 网站成立年份,小于当前年份时显示为 "2019-2026" 格式
343
-
344
- icp:
345
- enable: false
346
- url: "https://beian.miit.gov.cn/"
347
- text: "浙ICP备88888888"
348
-
349
- gongan:
350
- enable: false
351
- img: /images/beian.png
352
- url: ""
353
- text: ""
354
- ```
355
-
356
- ### 友情链接
357
-
358
- ```yml
359
- friends_link:
360
- 网站名称:
361
- url: https://example.com
362
- img: /images/logo.png # 可省略
363
- ```
364
-
365
- 友链图片建议放在站点 `source/images/` 目录下。
366
-
367
- ### 评论系统
368
-
369
- 四种评论系统任选其一,其余保持 `enable: false`。
370
-
371
- #### Valine
372
-
373
- 需要先创建 [LeanCloud](https://console.leancloud.app) 应用。
374
-
375
- ```yml
376
- leancloud:
377
- enable: true
378
- app_id: # LeanCloud App ID
379
- app_key: # LeanCloud App Key
380
-
381
- valine:
382
- enable: true
383
- avatar: monsterid
384
- placeholder: 给我的文章加点评论吧~
385
- ```
386
-
387
- #### Gitalk
388
-
389
- ```yml
390
- gitalk:
391
- enable: true
392
- clientID: # GitHub OAuth App Client ID
393
- clientSecret: # Client Secret
394
- repo: # 存储评论的仓库名
395
- owner: # 仓库所有者的 GitHub 用户名
396
- admin: # 管理员的 GitHub 用户名
397
- ```
398
-
399
- #### Twikoo
400
-
401
- ```yml
402
- twikoo:
403
- enable: true
404
- envId: # 环境 ID
405
- ```
406
-
407
- #### Giscus(推荐)
408
-
409
- 基于 GitHub Discussions,无需 OAuth Secret。前往 [giscus.app](https://giscus.app/) 获取配置参数。
410
-
411
- ```yml
412
- giscus:
413
- enable: true
414
- repo: owner/repo # 启用了 Discussions 的仓库
415
- repo_id: # 从 giscus.app 获取
416
- category: Announcements
417
- category_id: # 从 giscus.app 获取
418
- mapping: pathname
419
- reactions_enabled: 1
420
- emit_metadata: 0
421
- input_position: top
422
- lang: zh-CN
423
- ```
424
-
425
- ### 广告位
426
-
427
- 可自行增加 `ad_2`、`ad_3` 等条目。建议图片和 URL 避免包含 "ad" 等关键词,以免被广告拦截插件屏蔽。
428
-
429
- ```yml
430
- ads:
431
- ad_1:
432
- title: 广告标题
433
- img: /images/banner.jpg
434
- url: https://example.com
435
- width: 300
436
- ```
437
-
438
- ### 加密访问
439
-
440
- 使用 SweetAlert2 实现的密码保护。
441
-
442
- ```yml
443
- lock:
444
- enable: false
445
- password: 123456
446
- ```
447
-
448
- ### 自定义 CSS
449
-
450
- 主题提供 `source/css/custom.styl` 文件用于用户自定义样式覆盖,修改此文件不会影响主题升级。
451
-
452
- ## 页面创建
453
-
454
- 主题支持以下特殊页面,需要手动创建:
455
-
456
- ### 分类页面
457
-
458
- ```bash
459
- hexo new page categories
460
- ```
461
-
462
- 编辑生成的 `source/categories/index.md`:
463
-
464
- ```md
465
- ---
466
- title: categories
467
- type: categories
468
- layout: "categories"
469
- ---
470
- ```
471
-
472
- ### 标签页面
473
-
474
- ```bash
475
- hexo new page tags
476
- ```
477
-
478
- 编辑生成的 `source/tags/index.md`:
479
-
480
- ```md
481
- ---
482
- title: tags
483
- type: tags
484
- layout: "tags"
485
- ---
486
- ```
487
-
488
- ### 友情链接页面
489
-
490
- ```bash
491
- hexo new page friends
492
- ```
493
-
494
- 编辑生成的 `source/friends/index.md`:
495
-
496
- ```md
497
- ---
498
- title: friends
499
- type: friends
500
- layout: "friends"
501
- ---
502
- ```
503
-
504
- 然后在 `_config.ayeria.yml` 中配置 `friends_link`。
505
-
506
- ## Front-matter 参数
507
-
508
- 除了 Hexo 内置的 front-matter 字段外,本主题额外支持:
509
-
510
- | 字段 | 类型 | 说明 |
511
- |------|------|------|
512
- | `reward` | boolean | 是否显示打赏(`reward_type: 1` 时生效) |
513
- | `no_reward` | boolean | 强制关闭打赏 |
514
- | `copyright` | boolean | 是否显示版权声明(`copyright_type: 1` 时生效) |
515
- | `no_toc` | boolean | 关闭本文目录 |
516
- | `no_word_count` | boolean | 关闭本文字数统计 |
517
- | `math` | boolean | 开启本文数学公式(KaTeX `allpost: false` 时生效) |
518
- | `albums` | array | 相册模式,格式:`[["图片URL", "说明"], ...]` |
519
-
520
- 建议在 `scaffolds/post.md` 中预设常用字段:
521
-
522
- ```md
523
- ---
524
- title: {{ title }}
525
- date: {{ date }}
526
- categories:
527
- tags:
528
- reward: false
529
- copyright: true
530
- ---
531
- ```
532
-
533
- ## 多语言
534
-
535
- 支持 14 种语言,语言包位于 `languages/` 目录:
536
-
537
- zh-CN(简体中文)、zh-TW(繁体中文)、en(English)、ja(日本語)、ko(한국어)、es(Español)、de(Deutsch)、fr(Français)、ru(Русский)、vi(Tiếng Việt)、nl(Nederlands)、no(Norsk)、pt(Português)
538
-
539
- 在站点 `_config.yml` 中设置:
540
-
541
- ```yml
542
- language: zh-CN
543
- ```
544
-
545
- ## 开发
546
-
547
- 主题使用 Rollup 构建 CSS/JS。源码位于 `source-src/`,产出位于 `source/dist/`。
548
-
549
- ```bash
550
- cd themes/ayeria
551
- npm install
552
- npm run dev # 开发模式(监听变更)
553
- npm run build # 生产构建
554
- ```
555
-
556
- ## 开源协议
557
-
558
- [SATA License](LICENSE) — 基于 MIT,额外要求使用者给原项目点 Star 并感谢原作者。
559
-
560
- 感谢原作者 [Eric-Shen](https://github.com/Shen-Yu) 提供的优秀主题框架。
1
+ # hexo-theme-ayeria
2
+
3
+ [![npm version](https://img.shields.io/npm/v/hexo-theme-ayeria.svg)](https://www.npmjs.com/package/hexo-theme-ayeria)
4
+ [![npm downloads](https://img.shields.io/npm/dm/hexo-theme-ayeria.svg)](https://www.npmjs.com/package/hexo-theme-ayeria)
5
+
6
+ > **English / 英文文档:** [**README.en.md — 完整英文说明(English README)**](README.en.md)
7
+
8
+ ![Ayeria 主题效果预览](screenshots/Ayeria.png)
9
+
10
+ 一个干净且优雅的 Hexo 博客主题,基于 [Ayer](https://github.com/Shen-Yu/hexo-theme-ayer) 深度定制。
11
+
12
+ Ayeria —— 源自 Ayer(马来语"水"、西班牙语"昨日"),独立维护的衍生主题。原作者:[Eric-Shen](https://github.com/Shen-Yu)。
13
+
14
+ ## 功能特性
15
+
16
+ - 全屏封面 + typed.js 打字动效
17
+ - 深色模式一键切换
18
+ - 本地搜索(XML 索引 + 前端全文检索)
19
+ - 四种评论系统(Valine / Gitalk / Twikoo / Giscus)
20
+ - 数学公式(MathJax / KaTeX)+ Mermaid 流程图
21
+ - 打赏功能(数据驱动,支持多渠道、子渠道、品牌色、图标)
22
+ - 文章 TOC 目录、字数统计、代码复制、图片放大、版权声明
23
+ - 随机句子(本地 txt 文件或内置句子库,防重复队列)
24
+ - 告示板(自定义文字 / 一言 API)
25
+ - 访问量统计(不蒜子 / 友盟 CNZZ / Google Analytics / 百度统计)
26
+ - 网易云音乐嵌入
27
+ - 鼠标特效(自定义光标、点击爱心/爆炸/粒子)
28
+ - Canvas 动态背景
29
+ - 加密锁屏(SweetAlert2)
30
+ - 广告位、ICP/公安备案信息
31
+ - 14 种语言支持
32
+ - 自定义 CSS(`source/css/custom.styl`)
33
+ - Rollup 构建流水线
34
+
35
+ ## 安装
36
+
37
+ ### 方式一:npm(Hexo >= 5.0)
38
+
39
+ ```bash
40
+ npm i hexo-theme-ayeria -S
41
+ ```
42
+
43
+ ### 方式二:Git
44
+
45
+ ```bash
46
+ git clone https://github.com/KaleidScoper/hexo-theme-ayeria.git themes/ayeria
47
+ ```
48
+
49
+ 在站点根目录的 `_config.yml` 中启用主题:
50
+
51
+ ```yml
52
+ theme: ayeria
53
+ ```
54
+
55
+ ## 配置
56
+
57
+ 主题自带默认配置文件 `themes/ayeria/_config.yml`。你**不应直接修改**这个文件,而是在站点根目录创建 `_config.ayeria.yml`,只填写需要覆盖的选项。Hexo 5+ 会自动将其与主题默认配置合并。
58
+
59
+ 下文列出所有可配置项。
60
+
61
+ ### 侧边栏菜单
62
+
63
+ ```yml
64
+ menu:
65
+ 主页: /
66
+ 全部文章: /archives
67
+ 文章分类: /categories
68
+ 全部标签: /tags
69
+ 友情链接: /friends
70
+ 关于本站: /about
71
+ ```
72
+
73
+ 添加的页面需要先用 `hexo new page <name>` 创建(详见下方[页面创建](#页面创建))。
74
+
75
+ ### 封面
76
+
77
+ 全屏背景图封面,可选叠加 Logo。主题内附一张示例封面图 `source/images/cover2.webp`。
78
+
79
+ ```yml
80
+ cover:
81
+ enable: true
82
+ path: /images/cover.jpg # 背景图路径(放在主题或站点的 source/images/ 下)
83
+ logo: false # 封面 Logo 图片路径,不需要设为 false
84
+ ```
85
+
86
+ ### 打字动效
87
+
88
+ 封面上基于 [typed.js](https://github.com/mattboldt/typed.js) 的文字滚动效果。
89
+
90
+ ```yml
91
+ subtitle:
92
+ enable: true
93
+ text: 第一行文字
94
+ text2: 第二行文字 # 可留空
95
+ text3: 第三行文字 # 最多三行
96
+ startDelay: 1000
97
+ typeSpeed: 200
98
+ loop: true
99
+ backSpeed: 100
100
+ showCursor: true
101
+ ```
102
+
103
+ ### 网站图标与 Logo
104
+
105
+ ```yml
106
+ favicon: /favicon.svg # 浏览器标签页图标
107
+ logo: /favicon.svg # 侧边栏顶部 Logo
108
+ ```
109
+
110
+ 请将你自己的 favicon 放到站点 `source/` 或主题 `source/` 目录下。
111
+
112
+ ### 进度条
113
+
114
+ 页面顶部加载进度条(Pace.js CDN)。
115
+
116
+ ```yml
117
+ progressBar: true
118
+ ```
119
+
120
+ ### 告示板
121
+
122
+ ```yml
123
+ broadcast:
124
+ enable: true
125
+ type: 2 # 1: 自定义文字;2: 一言 API (hitokoto.cn)
126
+ text: 自定义告示内容 # type 为 1 时有效
127
+ ```
128
+
129
+ ### 随机句子
130
+
131
+ 页脚展示随机句子,支持本地 txt 文件(`source/data/random-sentences.txt`)或内置句子库。具有防重复队列机制。
132
+
133
+ ```yml
134
+ random_sentences:
135
+ enable: true
136
+ use_local_file: true # true: 读取 source/data/random-sentences.txt;false: 内置句子库
137
+ queue_size: 5 # 防重复队列大小,建议为句子总数的 1/4 ~ 1/3
138
+ ```
139
+
140
+ 本地 txt 文件格式:每行一句,`#` 开头为注释,双空格会转换为换行,空行自动忽略。
141
+
142
+ ### 文章功能
143
+
144
+ ```yml
145
+ excerpt_link: 显示更多... # 截断按钮文字(在文章中插入 <!--more--> 标记截断位置)
146
+ excerpt_all: false # true: 首页只显示文章归档,不展示正文
147
+
148
+ copy_btn: true # 代码复制按钮
149
+ share_enable: true # 文章分享按钮
150
+ share_china: true # 使用国内社交平台
151
+ share_text: 分享
152
+
153
+ toc: true # 文章目录(单篇可通过 front-matter no_toc: true 关闭)
154
+ image_viewer: true # 图片点击放大
155
+ ```
156
+
157
+ ### 分页文字
158
+
159
+ ```yml
160
+ nav_text:
161
+ page_prev: 上一页
162
+ page_next: 下一页
163
+ post_prev: 上一篇
164
+ post_next: 下一篇
165
+ ```
166
+
167
+ ### 字数统计
168
+
169
+ 需要安装插件:`npm i hexo-wordcount -S`
170
+
171
+ ```yml
172
+ word_count:
173
+ enable: true
174
+ only_article_visit: true # 只在文章详情页显示(不在首页显示)
175
+ ```
176
+
177
+ 单篇文章可通过 `no_word_count: true` 关闭。
178
+
179
+ ### 打赏
180
+
181
+ ```yml
182
+ reward_type: 1 # 0: 关闭;1: front-matter 中 reward:true 才显示;2: 所有文章
183
+ reward_wording: "如果这篇文章对你有帮助,可以请我喝杯茶"
184
+
185
+ reward:
186
+ button_text: "赏杯茶" # 留空则使用语言包默认值
187
+ channels:
188
+ - name: "支付宝"
189
+ icon: "ri-alipay-line" # RemixIcon 类名
190
+ color: "#1677FF" # 品牌主题色
191
+ qrcode: "/images/reward/alipay.jpg"
192
+ description: "支付宝扫一扫"
193
+
194
+ - name: "微信支付"
195
+ icon: "ri-wechat-pay-line"
196
+ color: "#07C160"
197
+ qrcode: "/images/reward/wechat.jpg"
198
+ description: "微信扫一扫"
199
+
200
+ - name: "USDT" # 支持子渠道
201
+ icon: "ri-coin-line"
202
+ color: "#50AF95"
203
+ description: "选择网络后扫码转账"
204
+ children:
205
+ - name: "TRC-20"
206
+ badge: "推荐"
207
+ qrcode: "/images/reward/USDT-TRC20.webp"
208
+ description: "Tron 链 · 手续费最低"
209
+ - name: "ERC-20"
210
+ qrcode: "/images/reward/USDT-ERC20.webp"
211
+ description: "以太坊主网"
212
+ ```
213
+
214
+ 二维码图片建议放在站点 `source/images/reward/` 目录下。单篇文章可通过 `no_reward: true` 强制关闭。
215
+
216
+ ### 版权声明
217
+
218
+ ```yml
219
+ copyright_type: 0 # 0: 关闭;1: front-matter 中 copyright:true 才显示;2: 所有文章
220
+ ```
221
+
222
+ ### 搜索
223
+
224
+ 需要安装插件:`npm i hexo-generator-searchdb -S`
225
+
226
+ 并在站点 `_config.yml` 中添加:
227
+
228
+ ```yml
229
+ search:
230
+ path: search.xml
231
+ field: post
232
+ format: html
233
+ ```
234
+
235
+ 然后启用主题搜索:
236
+
237
+ ```yml
238
+ search: true
239
+ ```
240
+
241
+ ### RSS 订阅
242
+
243
+ 需要安装插件:`npm i hexo-generator-feed -S`
244
+
245
+ 并在站点 `_config.yml` 中配置 feed。然后在主题配置中:
246
+
247
+ ```yml
248
+ rss: /atom.xml # 留空则不在侧边栏显示 RSS 入口
249
+ ```
250
+
251
+ ### 深色模式
252
+
253
+ ```yml
254
+ darkmode: true # 侧边栏显示深色模式切换按钮
255
+ ```
256
+
257
+ ### 视觉效果
258
+
259
+ ```yml
260
+ canvas_bg: 0 # 动态背景:0-关闭,1-动态线条(跟随鼠标)
261
+
262
+ mouse:
263
+ enable: false
264
+ path: /images/mouse.cur # 自定义鼠标样式文件路径
265
+
266
+ click_effect: 0 # 鼠标点击效果:0-关闭,1-爱心,2-爆炸烟花,3-粒子烟花
267
+ ```
268
+
269
+ ### 布局宽度
270
+
271
+ ```yml
272
+ layout:
273
+ article_width: 80rem
274
+ sidebar_width: 8rem
275
+ ```
276
+
277
+ ### GitHub Ribbon
278
+
279
+ 封面右上角 Fork-me 图标。可替换 `source/images/` 下的 forkme 图片自定义样式。
280
+
281
+ ```yml
282
+ github:
283
+ enable: false
284
+ url: https://github.com/your-username/your-repo
285
+ ```
286
+
287
+ ### 音乐播放器
288
+
289
+ 嵌入网易云音乐。
290
+
291
+ ```yml
292
+ music:
293
+ enable: false
294
+ type: 1 # 1: 小尺寸;2: 大尺寸
295
+ id: 22707008 # 网易云音乐 ID
296
+ autoPlay: true
297
+ ```
298
+
299
+ ### 统计分析
300
+
301
+ ```yml
302
+ busuanzi:
303
+ enable: true # 不蒜子页面访问量统计
304
+
305
+ cnzz:
306
+ enable: false
307
+ url: # 友盟 CNZZ 的 js 代码 src 链接
308
+
309
+ google_analytics: "" # Google Analytics 追踪 ID
310
+ baidu_analytics: "" # 百度统计追踪 ID
311
+ ```
312
+
313
+ ### 数学公式
314
+
315
+ MathJax 和 KaTeX 二选一。使用 KaTeX 需要更换渲染器:
316
+
317
+ ```bash
318
+ npm un hexo-renderer-marked -S && npm i hexo-renderer-markdown-it-katex -S
319
+ ```
320
+
321
+ ```yml
322
+ mathjax: false
323
+
324
+ katex:
325
+ enable: false
326
+ allpost: true # false: 仅 front-matter 中 math:true 的文章开启
327
+ copy_tex: false
328
+ ```
329
+
330
+ ### Mermaid 流程图
331
+
332
+ ```yml
333
+ mermaid:
334
+ enable: false
335
+ cdn: https://cdn.staticfile.org/mermaid/8.14.0/mermaid.min.js
336
+ theme: forest
337
+ ```
338
+
339
+ ### 网站信息
340
+
341
+ ```yml
342
+ since: 2019 # 网站成立年份,小于当前年份时显示为 "2019-2026" 格式
343
+
344
+ icp:
345
+ enable: false
346
+ url: "https://beian.miit.gov.cn/"
347
+ text: "浙ICP备88888888"
348
+
349
+ gongan:
350
+ enable: false
351
+ img: /images/beian.png
352
+ url: ""
353
+ text: ""
354
+ ```
355
+
356
+ ### 友情链接
357
+
358
+ ```yml
359
+ friends_link:
360
+ 网站名称:
361
+ url: https://example.com
362
+ img: /images/logo.png # 可省略
363
+ ```
364
+
365
+ 友链图片建议放在站点 `source/images/` 目录下。
366
+
367
+ ### 评论系统
368
+
369
+ 四种评论系统任选其一,其余保持 `enable: false`。
370
+
371
+ #### Valine
372
+
373
+ 需要先创建 [LeanCloud](https://console.leancloud.app) 应用。
374
+
375
+ ```yml
376
+ leancloud:
377
+ enable: true
378
+ app_id: # LeanCloud App ID
379
+ app_key: # LeanCloud App Key
380
+
381
+ valine:
382
+ enable: true
383
+ avatar: monsterid
384
+ placeholder: 给我的文章加点评论吧~
385
+ ```
386
+
387
+ #### Gitalk
388
+
389
+ ```yml
390
+ gitalk:
391
+ enable: true
392
+ clientID: # GitHub OAuth App Client ID
393
+ clientSecret: # Client Secret
394
+ repo: # 存储评论的仓库名
395
+ owner: # 仓库所有者的 GitHub 用户名
396
+ admin: # 管理员的 GitHub 用户名
397
+ ```
398
+
399
+ #### Twikoo
400
+
401
+ ```yml
402
+ twikoo:
403
+ enable: true
404
+ envId: # 环境 ID
405
+ ```
406
+
407
+ #### Giscus(推荐)
408
+
409
+ 基于 GitHub Discussions,无需 OAuth Secret。前往 [giscus.app](https://giscus.app/) 获取配置参数。
410
+
411
+ ```yml
412
+ giscus:
413
+ enable: true
414
+ repo: owner/repo # 启用了 Discussions 的仓库
415
+ repo_id: # 从 giscus.app 获取
416
+ category: Announcements
417
+ category_id: # 从 giscus.app 获取
418
+ mapping: pathname
419
+ reactions_enabled: 1
420
+ emit_metadata: 0
421
+ input_position: top
422
+ lang: zh-CN
423
+ ```
424
+
425
+ ### 广告位
426
+
427
+ 可自行增加 `ad_2`、`ad_3` 等条目。建议图片和 URL 避免包含 "ad" 等关键词,以免被广告拦截插件屏蔽。
428
+
429
+ ```yml
430
+ ads:
431
+ ad_1:
432
+ title: 广告标题
433
+ img: /images/banner.jpg
434
+ url: https://example.com
435
+ width: 300
436
+ ```
437
+
438
+ ### 加密访问
439
+
440
+ 使用 SweetAlert2 实现的密码保护。
441
+
442
+ ```yml
443
+ lock:
444
+ enable: false
445
+ password: 123456
446
+ ```
447
+
448
+ ### 自定义 CSS
449
+
450
+ 主题提供 `source/css/custom.styl` 文件用于用户自定义样式覆盖,修改此文件不会影响主题升级。
451
+
452
+ ## 页面创建
453
+
454
+ 主题支持以下特殊页面,需要手动创建:
455
+
456
+ ### 分类页面
457
+
458
+ ```bash
459
+ hexo new page categories
460
+ ```
461
+
462
+ 编辑生成的 `source/categories/index.md`:
463
+
464
+ ```md
465
+ ---
466
+ title: categories
467
+ type: categories
468
+ layout: "categories"
469
+ ---
470
+ ```
471
+
472
+ ### 标签页面
473
+
474
+ ```bash
475
+ hexo new page tags
476
+ ```
477
+
478
+ 编辑生成的 `source/tags/index.md`:
479
+
480
+ ```md
481
+ ---
482
+ title: tags
483
+ type: tags
484
+ layout: "tags"
485
+ ---
486
+ ```
487
+
488
+ ### 友情链接页面
489
+
490
+ ```bash
491
+ hexo new page friends
492
+ ```
493
+
494
+ 编辑生成的 `source/friends/index.md`:
495
+
496
+ ```md
497
+ ---
498
+ title: friends
499
+ type: friends
500
+ layout: "friends"
501
+ ---
502
+ ```
503
+
504
+ 然后在 `_config.ayeria.yml` 中配置 `friends_link`。
505
+
506
+ ## Front-matter 参数
507
+
508
+ 除了 Hexo 内置的 front-matter 字段外,本主题额外支持:
509
+
510
+ | 字段 | 类型 | 说明 |
511
+ |------|------|------|
512
+ | `reward` | boolean | 是否显示打赏(`reward_type: 1` 时生效) |
513
+ | `no_reward` | boolean | 强制关闭打赏 |
514
+ | `copyright` | boolean | 是否显示版权声明(`copyright_type: 1` 时生效) |
515
+ | `no_toc` | boolean | 关闭本文目录 |
516
+ | `no_word_count` | boolean | 关闭本文字数统计 |
517
+ | `math` | boolean | 开启本文数学公式(KaTeX `allpost: false` 时生效) |
518
+ | `albums` | array | 相册模式,格式:`[["图片URL", "说明"], ...]` |
519
+
520
+ 建议在 `scaffolds/post.md` 中预设常用字段:
521
+
522
+ ```md
523
+ ---
524
+ title: {{ title }}
525
+ date: {{ date }}
526
+ categories:
527
+ tags:
528
+ reward: false
529
+ copyright: true
530
+ ---
531
+ ```
532
+
533
+ ## 多语言
534
+
535
+ 支持 14 种语言,语言包位于 `languages/` 目录:
536
+
537
+ zh-CN(简体中文)、zh-TW(繁体中文)、en(English)、ja(日本語)、ko(한국어)、es(Español)、de(Deutsch)、fr(Français)、ru(Русский)、vi(Tiếng Việt)、nl(Nederlands)、no(Norsk)、pt(Português)
538
+
539
+ 在站点 `_config.yml` 中设置:
540
+
541
+ ```yml
542
+ language: zh-CN
543
+ ```
544
+
545
+ ## 开发
546
+
547
+ 主题使用 Rollup 构建 CSS/JS。源码位于 `source-src/`,产出位于 `source/dist/`。
548
+
549
+ ```bash
550
+ cd themes/ayeria
551
+ npm install
552
+ npm run dev # 开发模式(监听变更)
553
+ npm run build # 生产构建
554
+ ```
555
+
556
+ ## 开源协议
557
+
558
+ [SATA License](LICENSE) — 基于 MIT,额外要求使用者给原项目点 Star 并感谢原作者。
559
+
560
+ 感谢原作者 [Eric-Shen](https://github.com/Shen-Yu) 提供的优秀主题框架。