From 23aab88e04238f822048d86874962d46d896d7dc Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 12 Feb 2024 23:07:56 +0800 Subject: [PATCH] [feat] plugins refactoring --- _config.yml | 165 ++++++------ layout/404.ejs | 2 +- .../{plugins => }/comments/artalk/layout.ejs | 0 .../{plugins => }/comments/artalk/script.ejs | 4 +- .../{plugins => }/comments/beaudar/layout.ejs | 0 .../{plugins => }/comments/beaudar/script.ejs | 0 .../{plugins => }/comments/giscus/layout.ejs | 0 .../{plugins => }/comments/giscus/script.ejs | 5 +- .../{plugins => }/comments/layout.ejs | 0 .../{plugins => }/comments/script.ejs | 0 .../{plugins => }/comments/twikoo/layout.ejs | 0 .../{plugins => }/comments/twikoo/script.ejs | 2 +- .../comments/utterances/layout.ejs | 0 .../comments/utterances/script.ejs | 0 .../{plugins => }/comments/waline/layout.ejs | 0 .../{plugins => }/comments/waline/script.ejs | 4 +- layout/_partial/head.ejs | 1 - layout/_partial/main/post_list/post_card.ejs | 2 +- layout/_partial/plugins/ai/tianli_gpt.ejs | 9 - layout/_partial/plugins/parser/head.ejs | 3 - layout/_partial/plugins/parser/katex/head.ejs | 3 - .../_partial/plugins/parser/katex/script.ejs | 4 - .../plugins/parser/mermaid/script.ejs | 29 --- layout/_partial/plugins/parser/script.ejs | 9 - layout/_partial/scripts.ejs | 32 +++ layout/_partial/scripts/defines.ejs | 31 +++ layout/_partial/scripts/index.ejs | 175 ------------- layout/_partial/scripts/services.ejs | 39 +++ layout/_partial/scripts/sidebar.ejs | 25 ++ layout/_partial/scripts/utils.ejs | 158 ++++++++++++ layout/_plugins/copycode.ejs | 13 + layout/_plugins/fancybox.ejs | 32 +++ layout/_plugins/heti.ejs | 21 ++ layout/_plugins/index.ejs | 24 ++ layout/_plugins/lazyload.ejs | 21 ++ .../script.ejs => _plugins/mathjax.ejs} | 2 +- layout/_plugins/mermaid.ejs | 29 +++ layout/_plugins/preload.ejs | 9 + layout/_plugins/scrollreveal.ejs | 15 ++ layout/_plugins/search/local_search.ejs | 8 + layout/_plugins/swiper.ejs | 26 ++ layout/_plugins/tianli_gpt.ejs | 9 + layout/layout.ejs | 4 +- layout/page.ejs | 12 +- scripts/tags/lib/link.js | 2 +- source/css/_layout/partial/related.styl | 4 + source/css/_layout/tag-plugins/tabs.styl | 2 + source/css/_layout/tag-plugins/timeline.styl | 46 ++-- source/css/_layout/widgets/timeline.styl | 31 ++- source/css/_layout/widgets/toc.styl | 2 +- source/js/main.js | 235 +----------------- source/js/plugins/copycode.js | 52 ++-- source/js/plugins/fcircle.js | 92 ------- source/js/plugins/friends.js | 84 ------- source/js/plugins/ghinfo.js | 85 ------- source/js/plugins/linkcard.js | 48 ---- source/js/plugins/marked.js | 50 ---- source/js/plugins/memos.js | 132 ---------- source/js/plugins/sites.js | 87 ------- source/js/plugins/timeline.js | 162 ------------ source/js/plugins/weibo.js | 116 --------- source/js/search/local-search.js | 32 +++ source/js/services/fcircle.js | 36 +++ source/js/services/friends.js | 27 ++ source/js/services/ghinfo.js | 33 +++ source/js/services/mdrender.js | 10 + source/js/services/memos.js | 73 ++++++ source/js/services/siteinfo.js | 38 +++ source/js/services/sites.js | 30 +++ source/js/services/timeline.js | 108 ++++++++ source/js/services/weibo.js | 60 +++++ 71 files changed, 1119 insertions(+), 1485 deletions(-) rename layout/_partial/{plugins => }/comments/artalk/layout.ejs (100%) rename layout/_partial/{plugins => }/comments/artalk/script.ejs (82%) rename layout/_partial/{plugins => }/comments/beaudar/layout.ejs (100%) rename layout/_partial/{plugins => }/comments/beaudar/script.ejs (100%) rename layout/_partial/{plugins => }/comments/giscus/layout.ejs (100%) rename layout/_partial/{plugins => }/comments/giscus/script.ejs (94%) rename layout/_partial/{plugins => }/comments/layout.ejs (100%) rename layout/_partial/{plugins => }/comments/script.ejs (100%) rename layout/_partial/{plugins => }/comments/twikoo/layout.ejs (100%) rename layout/_partial/{plugins => }/comments/twikoo/script.ejs (85%) rename layout/_partial/{plugins => }/comments/utterances/layout.ejs (100%) rename layout/_partial/{plugins => }/comments/utterances/script.ejs (100%) rename layout/_partial/{plugins => }/comments/waline/layout.ejs (100%) rename layout/_partial/{plugins => }/comments/waline/script.ejs (90%) delete mode 100644 layout/_partial/plugins/ai/tianli_gpt.ejs delete mode 100644 layout/_partial/plugins/parser/head.ejs delete mode 100644 layout/_partial/plugins/parser/katex/head.ejs delete mode 100644 layout/_partial/plugins/parser/katex/script.ejs delete mode 100755 layout/_partial/plugins/parser/mermaid/script.ejs delete mode 100644 layout/_partial/plugins/parser/script.ejs create mode 100644 layout/_partial/scripts.ejs create mode 100644 layout/_partial/scripts/defines.ejs delete mode 100644 layout/_partial/scripts/index.ejs create mode 100644 layout/_partial/scripts/services.ejs create mode 100644 layout/_partial/scripts/sidebar.ejs create mode 100644 layout/_partial/scripts/utils.ejs create mode 100644 layout/_plugins/copycode.ejs create mode 100644 layout/_plugins/fancybox.ejs create mode 100644 layout/_plugins/heti.ejs create mode 100644 layout/_plugins/index.ejs create mode 100644 layout/_plugins/lazyload.ejs rename layout/{_partial/plugins/parser/mathjax/script.ejs => _plugins/mathjax.ejs} (85%) mode change 100755 => 100644 create mode 100755 layout/_plugins/mermaid.ejs create mode 100644 layout/_plugins/preload.ejs create mode 100644 layout/_plugins/scrollreveal.ejs create mode 100644 layout/_plugins/search/local_search.ejs create mode 100644 layout/_plugins/swiper.ejs create mode 100644 layout/_plugins/tianli_gpt.ejs delete mode 100644 source/js/plugins/fcircle.js delete mode 100644 source/js/plugins/friends.js delete mode 100644 source/js/plugins/ghinfo.js delete mode 100644 source/js/plugins/linkcard.js delete mode 100644 source/js/plugins/marked.js delete mode 100644 source/js/plugins/memos.js delete mode 100644 source/js/plugins/sites.js delete mode 100644 source/js/plugins/timeline.js delete mode 100644 source/js/plugins/weibo.js create mode 100644 source/js/services/fcircle.js create mode 100644 source/js/services/friends.js create mode 100644 source/js/services/ghinfo.js create mode 100644 source/js/services/mdrender.js create mode 100644 source/js/services/memos.js create mode 100644 source/js/services/siteinfo.js create mode 100644 source/js/services/sites.js create mode 100644 source/js/services/timeline.js create mode 100644 source/js/services/weibo.js 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 += `` html += site_background html += partial('_partial/cover/index') - html += `
` + html += `
` html += `