diff --git a/_config.yml b/_config.yml
index b79c24d..75c6228 100755
--- a/_config.yml
+++ b/_config.yml
@@ -289,11 +289,6 @@ footer:
######## Tag Plugins ########
tag_plugins:
- # {% link %}
- linkcard:
- # 设置 api 可以自动提取网页标题、图标,服务部署方法:https://github.com/xaoxuu/site-info-api/
- # 接口测试通过后,把按钮的 href 部分替换成 ${href} 之后填写到下方,例如:https://api.vlts.cc/site_info/v1?url=${href}
- api:
# {% box %} / {% note %}
note:
default_color: '' # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error
@@ -366,43 +361,83 @@ tag_plugins:
size: mix # s / m / l / xl / mix
ratio: square # origin / square
-
-
-######## JS Plugins ########
-plugins:
- ## required plugins ##
- # jquery
+# 基础依赖
+dependencies:
jquery: https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js
-
- # stellar api
- stellar:
- sites: /js/plugins/sites.js
- friends: /js/plugins/friends.js
- ghinfo: /js/plugins/ghinfo.js
- timeline: /js/plugins/timeline.js
- linkcard: /js/plugins/linkcard.js
- fcircle: /js/plugins/fcircle.js
- weibo: /js/plugins/weibo.js
- memos: /js/plugins/memos.js
- marked: /js/plugins/marked.js
-
marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
- ## optional plugins ##
+
+# 内置服务,按需加载(页面内用到了就会加载,没有用到就不会加载)
+services:
+ # 外部 md 渲染
+ mdrender:
+ js: /js/services/mdrender.js
+ # 数据填充类
+ siteinfo:
+ js: /js/services/siteinfo.js
+ # 设置 api 可以自动提取网页标题、图标,服务部署方法:https://github.com/xaoxuu/site-info-api/
+ # 接口测试通过后,把按钮的 href 部分替换成 ${href} 之后填写到下方,例如:https://api.vlts.cc/site_info/v1?url=${href}
+ api:
+ ghinfo:
+ js: /js/services/ghinfo.js
+ # 网格布局类
+ sites:
+ js: /js/services/sites.js
+ friends:
+ js: /js/services/friends.js
+ # 列表布局类
+ timeline:
+ js: /js/services/timeline.js
+ fcircle:
+ js: /js/services/fcircle.js
+ weibo:
+ js: /js/services/weibo.js
+ memos:
+ js: /js/services/memos.js
+
+
+# 扩展插件接入方法:(插件名下面用 #plugin# 代替)
+# 1. 在这里增加 #plugin# 配置,至少赢含有 enable 字段,默认为空(不启用)
+# 2. 新建文件 layout/_plugins/#plugin#.ejs 文件中设置编写加载代码。
+# 2.1. 在该文件中可以直接使用 conf 来读取用户在【步骤 1】填写的配置字段内容
+# 2.2. 如果需要引入 css 或 js,可以使用 utils.css(xxx)、utils.js(xxx),具体可参考 layout/_plugins/fancybox.ejs
+# 2.3. 如果需要本地 js 文件,请放入 /source/js/plugins 文件夹中,引入方式为:utils.js('/js/plugins/xxx.js');
+# 3. 如果这个插件只需要引入外部文件,可以在【步骤 1】处增加 inject 字段,而无需进入【步骤 2】创建 ejs,参考 katex
+plugins:
+
# preload
preload:
enable: true
service: flying_pages # flying_pages
flying_pages: https://cdn.bootcdn.net/ajax/libs/flying-pages/2.1.2/flying-pages.min.js
- # image lazyload
+ # lazyload
# https://www.npmjs.com/package/vanilla-lazyload
lazyload:
enable: true # [hexo clean && hexo s] is required after changing this value.
js: https://cdn.bootcdn.net/ajax/libs/vanilla-lazyload/17.8.4/lazyload.min.js
transition: fade # blur, fade
+ # https://fancyapps.com/docs/ui/fancybox/
+ # available for {% image xxx %}
+ fancybox:
+ enable: true
+ loader: /js/plugins/fancybox-loader.js
+ js: https://cdn.bootcdn.net/ajax/libs/fancyapps-ui/5.0.22/fancybox/fancybox.umd.min.js
+ css: https://cdn.bootcdn.net/ajax/libs/fancyapps-ui/5.0.22/fancybox/fancybox.min.css
+ # 让 md 语法图片支持放大可以这样写: .md-text img:not([class]), .md-text .image img
+ # 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
+ # 使用 twikoo 评论可以写: .tk-content img:not([class*="emo"])
+ # 使用 waline 评论可以写: #waline_container .vcontent img
+ selector: .timenode p>img # 多个选择器用英文逗号隔开
+
+ # swiper
+ swiper:
+ enable: true
+ css: https://unpkg.com/swiper@10.3.1/swiper-bundle.min.css
+ js: https://unpkg.com/swiper@10.3.1/swiper-bundle.min.js
+
# https://scrollrevealjs.org/api/reveal.html
scrollreveal:
enable: #true
@@ -411,33 +446,28 @@ plugins:
duration: 800 # ms
interval: 100 # ms
scale: 1 # 0.1~1
-
- # https://fancyapps.com/docs/ui/fancybox/
- # available for {% image xxx %}
- fancybox:
- enable: true
- js: https://cdn.bootcdn.net/ajax/libs/fancyapps-ui/5.0.22/fancybox/fancybox.umd.min.js
- css: https://cdn.bootcdn.net/ajax/libs/fancyapps-ui/5.0.22/fancybox/fancybox.min.css
- # 让 md 语法图片支持放大可以这样写: .md-text img:not([class]), .md-text .image img
- # 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
- # 使用 twikoo 评论可以写: .tk-content img:not([class*="emo"])
- # 使用 waline 评论可以写: #waline_container .vcontent img
- selector: # 多个选择器用英文逗号隔开
-
- # swiper
- swiper:
- enable: true
- css: https://unpkg.com/swiper@10.3/swiper-bundle.min.css
- js: https://unpkg.com/swiper@10.3/swiper-bundle.min.js
-
-
- # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
- # https://github.com/sivan/heti
- heti:
- enable: false # 此插件会和代码块冲突,仅适用于纯中文博主。
- css: https://unpkg.com/heti@0.9.2/umd/heti.min.css
- js: https://unpkg.com/heti@0.9.2/umd/heti-addon.min.js
-
+
+ # AI 摘要
+ # https://github.com/zhheo/Post-Abstract-AI
+ tianli_gpt:
+ enable: #true
+ js: https://cdn1.tianli0.top/gh/zhheo/Post-Abstract-AI@0.15.2/tianli_gpt.min.js
+ field: post # all, post, wiki
+ api: 5Q5mpqRK5DkwT1X9Gi5e # tianli_gpt key
+ limit: 1000 # 设置提交的字数限制,默认为1000字,上限为5000,超过5000字符将被截断,不能为空
+ typingAnimate: true # 打字机动画
+
+ # Katex - The fastest math typesetting library for the web
+ # https://katex.org/docs/autorender.html
+ # https://github.com/KaTeX/KaTeX
+ # 使用 hexo-renderer-markdown-it-plus 作为公式渲染器:npm uninstall hexo-renderer-marked --save npm install hexo-renderer-markdown-it-plus --save
+ katex:
+ enable: #true # 可以在特定文章的 front-matter 中设置 katex: true 来开启,也可以在这里设置全局开启
+ inject: |
+
+
+
+
# MathJax
# 需在Markdown文件开头加入mathjax: true
# 推荐使用Pandoc: npm uninstall hexo-renderer-marked --save & npm install hexo-renderer-pandoc --save
@@ -445,16 +475,6 @@ plugins:
enable: # true # 可以在特定文章的 front-matter 中设置 mathjax: true 来开启,也可以在这里设置全局开启
js: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML
- # Katex - The fastest math typesetting library for the web
- # https://katex.org/docs/autorender.html
- # https://github.com/KaTeX/KaTeX
- # 使用 hexo-renderer-markdown-it-plus 作为公式渲染器:npm uninstall hexo-renderer-marked --save npm install hexo-renderer-markdown-it-plus --save
- katex:
- enable: # true # 可以在特定文章的 front-matter 中设置 katex: true 来开启,也可以在这里设置全局开启
- min_css:
- min_js:
- auto_render_min_js:
-
# Mermaid - markdwon to flow chart, seq chart, class chart ...
# 需要安装 npm install --save hexo-filter-mermaid-diagrams
# 使用时 需要在Markdown文件开头加入 mermaid: true
@@ -471,23 +491,22 @@ plugins:
js: https://cdn.jsdelivr.net/npm/mermaid@v9/dist/mermaid.min.js
# Available themes: default | dark | forest | neutral
theme: neutral
-
+
# 代码块复制按钮
copycode:
enable: true
- js: /js/plugins/copycode.js
default_text: 'Copy'
success_text: 'Copied'
toast: 复制成功
- # AI 摘要
- # https://github.com/zhheo/Post-Abstract-AI
- tianli_gpt:
- enable: false
- field: post # all, post, wiki
- api: 5Q5mpqRK5DkwT1X9Gi5e # tianli_gpt key
- limit: 1000 # 设置提交的字数限制,默认为1000字,上限为5000,超过5000字符将被截断,不能为空
- typingAnimate: true # 打字机动画
+ # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
+ # https://github.com/sivan/heti
+ heti:
+ enable: false # 此插件会和代码块冲突,仅适用于纯中文博主。
+ css: https://unpkg.com/heti@0.9.2/umd/heti.min.css
+ js: https://unpkg.com/heti@0.9.2/umd/heti-addon.min.js
+
+
style:
prefers_theme: auto # auto / light / dark
diff --git a/layout/404.ejs b/layout/404.ejs
index a37a22d..de35332 100755
--- a/layout/404.ejs
+++ b/layout/404.ejs
@@ -16,4 +16,4 @@ page.robots = 'none';
<%- __('page.error.action') %>
-<%- partial('_partial/plugins/comments/layout') %>
+<%- partial('_partial/comments/layout') %>
diff --git a/layout/_partial/plugins/comments/artalk/layout.ejs b/layout/_partial/comments/artalk/layout.ejs
similarity index 100%
rename from layout/_partial/plugins/comments/artalk/layout.ejs
rename to layout/_partial/comments/artalk/layout.ejs
diff --git a/layout/_partial/plugins/comments/artalk/script.ejs b/layout/_partial/comments/artalk/script.ejs
similarity index 82%
rename from layout/_partial/plugins/comments/artalk/script.ejs
rename to layout/_partial/comments/artalk/script.ejs
index 255c1bc..9ea27b8 100644
--- a/layout/_partial/plugins/comments/artalk/script.ejs
+++ b/layout/_partial/comments/artalk/script.ejs
@@ -1,8 +1,8 @@
diff --git a/layout/_partial/plugins/comments/layout.ejs b/layout/_partial/comments/layout.ejs
similarity index 100%
rename from layout/_partial/plugins/comments/layout.ejs
rename to layout/_partial/comments/layout.ejs
diff --git a/layout/_partial/plugins/comments/script.ejs b/layout/_partial/comments/script.ejs
similarity index 100%
rename from layout/_partial/plugins/comments/script.ejs
rename to layout/_partial/comments/script.ejs
diff --git a/layout/_partial/plugins/comments/twikoo/layout.ejs b/layout/_partial/comments/twikoo/layout.ejs
similarity index 100%
rename from layout/_partial/plugins/comments/twikoo/layout.ejs
rename to layout/_partial/comments/twikoo/layout.ejs
diff --git a/layout/_partial/plugins/comments/twikoo/script.ejs b/layout/_partial/comments/twikoo/script.ejs
similarity index 85%
rename from layout/_partial/plugins/comments/twikoo/script.ejs
rename to layout/_partial/comments/twikoo/script.ejs
index 6d8440a..a905f41 100644
--- a/layout/_partial/plugins/comments/twikoo/script.ejs
+++ b/layout/_partial/comments/twikoo/script.ejs
@@ -1,7 +1,7 @@
-
-<% } %>
diff --git a/layout/_partial/plugins/parser/head.ejs b/layout/_partial/plugins/parser/head.ejs
deleted file mode 100644
index 667c838..0000000
--- a/layout/_partial/plugins/parser/head.ejs
+++ /dev/null
@@ -1,3 +0,0 @@
-<% if (page.katex == true || theme.plugins.katex.enable == true) { %>
- <%- partial('katex/head') %>
-<% } %>
\ No newline at end of file
diff --git a/layout/_partial/plugins/parser/katex/head.ejs b/layout/_partial/plugins/parser/katex/head.ejs
deleted file mode 100644
index b34197e..0000000
--- a/layout/_partial/plugins/parser/katex/head.ejs
+++ /dev/null
@@ -1,3 +0,0 @@
-<% if (theme.plugins.katex) { %>
- <%- theme.plugins.katex.min_css %>
-<% } %>
diff --git a/layout/_partial/plugins/parser/katex/script.ejs b/layout/_partial/plugins/parser/katex/script.ejs
deleted file mode 100644
index c51d756..0000000
--- a/layout/_partial/plugins/parser/katex/script.ejs
+++ /dev/null
@@ -1,4 +0,0 @@
-<% if (theme.plugins.katex) { %>
- <%- theme.plugins.katex.min_js %>
- <%- theme.plugins.katex.auto_render_min_js %>
-<% } %>
diff --git a/layout/_partial/plugins/parser/mermaid/script.ejs b/layout/_partial/plugins/parser/mermaid/script.ejs
deleted file mode 100755
index fa9a6d3..0000000
--- a/layout/_partial/plugins/parser/mermaid/script.ejs
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
\ No newline at end of file
diff --git a/layout/_partial/plugins/parser/script.ejs b/layout/_partial/plugins/parser/script.ejs
deleted file mode 100644
index 3f112d5..0000000
--- a/layout/_partial/plugins/parser/script.ejs
+++ /dev/null
@@ -1,9 +0,0 @@
-<% if (page.katex == true || theme.plugins.katex.enable) { %>
- <%- partial('katex/script') %>
-<% } %>
-<% if (page.mathjax == true || theme.plugins.mathjax.enable) { %>
- <%- partial('mathjax/script') %>
-<% } %>
-<% if (page.mermaid == true || theme.plugins.mermaid.enable) { %>
- <%- partial('mermaid/script') %>
-<% } %>
\ No newline at end of file
diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs
new file mode 100644
index 0000000..debc6dd
--- /dev/null
+++ b/layout/_partial/scripts.ejs
@@ -0,0 +1,32 @@
+<%
+
+function custom_inject() {
+ var el = '';
+ for (let item of (config.inject?.script || [])) {
+ el += item;
+ }
+ for (let item of (theme.inject?.script || [])) {
+ el += item;
+ }
+ for (let item of (page.inject?.script || [])) {
+ el += item;
+ }
+ return el;
+}
+
+%>
+<%- partial('scripts/defines') %>
+<%- partial('scripts/utils') %>
+<%- partial('scripts/sidebar') %>
+
+
+
+
+
+<%- partial('comments/script') %>
+
+<%- partial('scripts/services') %>
+<%- partial('../_plugins/index') %>
+
+
+<%- custom_inject() %>
diff --git a/layout/_partial/scripts/defines.ejs b/layout/_partial/scripts/defines.ejs
new file mode 100644
index 0000000..ab9b1c4
--- /dev/null
+++ b/layout/_partial/scripts/defines.ejs
@@ -0,0 +1,31 @@
+
diff --git a/layout/_partial/scripts/index.ejs b/layout/_partial/scripts/index.ejs
deleted file mode 100644
index 04a13bb..0000000
--- a/layout/_partial/scripts/index.ejs
+++ /dev/null
@@ -1,175 +0,0 @@
-<%
-
-function custom_inject() {
- var el = '';
- for (let item of (config.inject?.script || [])) {
- el += item;
- }
- for (let item of (theme.inject?.script || [])) {
- el += item;
- }
- for (let item of (page.inject?.script || [])) {
- el += item;
- }
- return el;
-}
-
-%>
-
-
-
-
-
-
-<%- partial('../plugins/comments/script') %>
-<%- partial('../plugins/parser/script') %>
-
-
-<%- custom_inject() %>
diff --git a/layout/_partial/scripts/services.ejs b/layout/_partial/scripts/services.ejs
new file mode 100644
index 0000000..95d29cc
--- /dev/null
+++ b/layout/_partial/scripts/services.ejs
@@ -0,0 +1,39 @@
+
\ No newline at end of file
diff --git a/layout/_partial/scripts/sidebar.ejs b/layout/_partial/scripts/sidebar.ejs
new file mode 100644
index 0000000..c40df41
--- /dev/null
+++ b/layout/_partial/scripts/sidebar.ejs
@@ -0,0 +1,25 @@
+
\ No newline at end of file
diff --git a/layout/_partial/scripts/utils.ejs b/layout/_partial/scripts/utils.ejs
new file mode 100644
index 0000000..6d902a6
--- /dev/null
+++ b/layout/_partial/scripts/utils.ejs
@@ -0,0 +1,158 @@
+
diff --git a/layout/_plugins/copycode.ejs b/layout/_plugins/copycode.ejs
new file mode 100644
index 0000000..89f0ecf
--- /dev/null
+++ b/layout/_plugins/copycode.ejs
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/layout/_plugins/fancybox.ejs b/layout/_plugins/fancybox.ejs
new file mode 100644
index 0000000..411729b
--- /dev/null
+++ b/layout/_plugins/fancybox.ejs
@@ -0,0 +1,32 @@
+
\ No newline at end of file
diff --git a/layout/_plugins/heti.ejs b/layout/_plugins/heti.ejs
new file mode 100644
index 0000000..0ead3dc
--- /dev/null
+++ b/layout/_plugins/heti.ejs
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/layout/_plugins/index.ejs b/layout/_plugins/index.ejs
new file mode 100644
index 0000000..5a82b04
--- /dev/null
+++ b/layout/_plugins/index.ejs
@@ -0,0 +1,24 @@
+<%
+function loadPlugins() {
+ var el = ''
+
+ // search
+ if (theme.search[theme.search.service]) {
+ el += partial(`search/${theme.search.service}`, {conf: theme.search[theme.search.service]});
+ }
+
+ // others
+ for (let id of Object.keys(theme.plugins)) {
+ const conf = Object.assign({}, theme.plugins[id], page[id])
+ if (page[id] == true || conf.enable) {
+ if (conf.inject?.length > 0) {
+ el += conf.inject
+ } else {
+ el += partial(`${id}`, {conf: conf})
+ }
+ }
+ }
+ return el
+}
+%>
+<%- loadPlugins() %>
diff --git a/layout/_plugins/lazyload.ejs b/layout/_plugins/lazyload.ejs
new file mode 100644
index 0000000..d9b8c82
--- /dev/null
+++ b/layout/_plugins/lazyload.ejs
@@ -0,0 +1,21 @@
+
+
\ No newline at end of file
diff --git a/layout/_partial/plugins/parser/mathjax/script.ejs b/layout/_plugins/mathjax.ejs
old mode 100755
new mode 100644
similarity index 85%
rename from layout/_partial/plugins/parser/mathjax/script.ejs
rename to layout/_plugins/mathjax.ejs
index 63b1b27..32819e2
--- a/layout/_partial/plugins/parser/mathjax/script.ejs
+++ b/layout/_plugins/mathjax.ejs
@@ -1,4 +1,4 @@
-
+
+
\ No newline at end of file
diff --git a/layout/_plugins/preload.ejs b/layout/_plugins/preload.ejs
new file mode 100644
index 0000000..dadb747
--- /dev/null
+++ b/layout/_plugins/preload.ejs
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/layout/_plugins/scrollreveal.ejs b/layout/_plugins/scrollreveal.ejs
new file mode 100644
index 0000000..2b905bd
--- /dev/null
+++ b/layout/_plugins/scrollreveal.ejs
@@ -0,0 +1,15 @@
+
+
diff --git a/layout/_plugins/search/local_search.ejs b/layout/_plugins/search/local_search.ejs
new file mode 100644
index 0000000..bc7aaa0
--- /dev/null
+++ b/layout/_plugins/search/local_search.ejs
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/layout/_plugins/swiper.ejs b/layout/_plugins/swiper.ejs
new file mode 100644
index 0000000..9bc5b9a
--- /dev/null
+++ b/layout/_plugins/swiper.ejs
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/layout/_plugins/tianli_gpt.ejs b/layout/_plugins/tianli_gpt.ejs
new file mode 100644
index 0000000..b3a7d97
--- /dev/null
+++ b/layout/_plugins/tianli_gpt.ejs
@@ -0,0 +1,9 @@
+<% if (['all', page.layout].includes(theme.plugins.tianli_gpt.field)) { %>
+
+
+<% } %>
diff --git a/layout/layout.ejs b/layout/layout.ejs
index 387ce4c..e619da8 100755
--- a/layout/layout.ejs
+++ b/layout/layout.ejs
@@ -42,7 +42,7 @@ html += ``
html += `