From 81c536e65d1415356004f31659df5c62fab0be4a Mon Sep 17 00:00:00 2001 From: bisnsh Date: Wed, 13 Aug 2025 11:07:50 +0800 Subject: [PATCH] update --- source/_posts/add-ai-summary.md | 14 ++++--- source/_posts/add-calendar-side.md | 1 - .../_posts/add-welcome-message-in-sidebar.md | 2 - source/_posts/custom-bottom.md | 3 +- source/_posts/custom-font.md | 17 ++++++-- source/_posts/custom-right-menu.md | 2 - source/_posts/go-to-random-page.md | 18 ++++++-- source/_posts/hello-world.md | 42 ------------------- source/_posts/set-shuoshuo-page.md | 1 - 9 files changed, 37 insertions(+), 63 deletions(-) delete mode 100644 source/_posts/hello-world.md diff --git a/source/_posts/add-ai-summary.md b/source/_posts/add-ai-summary.md index e59587b..3750285 100644 --- a/source/_posts/add-ai-summary.md +++ b/source/_posts/add-ai-summary.md @@ -8,9 +8,6 @@ summary: >- 这篇文章介绍了如何在Hexo博客中添加AI摘要功能,作者寻找并尝试了多个AI摘要插件后,最终选择了hexo-ai-summary-liushen插件。安装过程中,作者详细说明了如何安装额外依赖,并在Hexo配置文件中添加了相关配置。文章还提供了关于内容清洗、摘要字段设置、日志等级、API接口配置、插件适配等方面的详细说明和配置示例。此外,作者还介绍了如何将AI摘要集成到Hexo主题中,并提供了相关的CSS样式和JavaScript动效代码,以实现更加逼真的摘要效果。最后,作者提醒用户在运行插件前注意备份,并介绍了如何处理可能出现的缓存问题。 date: 2025-08-12 09:46:25 --- - -{% series webcustom %} - 之前在wordpress中看到过ai插件,现在使用hexo好像有洪墨AI,但是收费,有点负担不了,于是寻找代替品,真的找到了 {% link liushen开发的插件,ai-summary,https://blog.liushen.fun/posts/40702a0d/ %} @@ -20,13 +17,14 @@ date: 2025-08-12 09:46:25 ```BASH npm install hexo-ai-summary-liushen --save ``` + 安装额外插件: ```BASH npm install axios p-limit node-fetch --save ``` -安装后,在Hexo配置文件`_config.yml`任意位置添加以下配置: +安装后,在Hexo配置文件 `_config.yml`任意位置添加以下配置: ```YAML # hexo-ai-summary-liushen @@ -125,6 +123,7 @@ concurrency:很多模型会限制并发,所以这里我利用p-limit插件 如果一切正常,应该可以在每篇文章的顶部看到对应的摘要文段。 # API推荐 + 由于插件需要自行配置API,可能在这方面需要一些帮助,所以我整理了一些免费API接口,如下: | 接口名称 | 优势 | 劣势 | 字符上限 | 模型类型 | 稳定性 | 简介 | @@ -134,7 +133,6 @@ concurrency:很多模型会限制并发,所以这里我利用p-limit插件 | ChatAnywhere GPT_API_free | - 支持多种主流模型(GPT-4o、DeepSeek等)- 免费使用,无需代理- 接口兼容OpenAI标准,接入便捷 | - 免费调用次数有限制(如GPT-4o每日5次)- 可能存在使用高峰时段资源紧张的情况 | 取决于所选模型(如GPT-4o支持128K tokens) | 多种主流大模型(GPT-4o、DeepSeek等) | 中 | 提供多种主流大模型的免费API接口,支持国内直连,适合开发者测试和学习使用。 | | QWQ.aigpu.cn | - 完全免费,无需注册- 基于分布式算力,支持高性能模型- 支持本地运行和共享算力 | - 高峰时段可能需要排队- 依赖社区贡献的算力,稳定性可能受影响 | 未明确限制,具体取决于模型和算力资源 | QwQ 32B大语言模型 | 中等(受算力资源影响) | 基于分布式家用显卡算力的平台,提供免费的大语言模型API,支持本地运行和共享算力,适合开发者和爱好者使用。 | - 由于AI摘要仅仅需要小模型即可驾驭,无需众多训练知识,所以这里两个Lite版本的模型完全可以实现,唯一不同的区别可能就是上下文能力啦,更好的模型可以接受更长的文本输入,不容易丢失我们给予的prompt,输出更为准确,更符合要求,但是考虑到成本和稳定性原因,我还是建议前两个。 注意各家都有自有api接口和OpenAI类型接口,我们这里选择OpenAI接口,输入完整的地址如混元的兼容接口: @@ -142,10 +140,12 @@ https://api.hunyuan.cloud.tencent.com/v1/chat/completions 申请token后正常使用即可。 # Hexo适配 + 说在前面 有些主题已经有静态ai摘要的功能了,可以无需下面的步骤,使用插件向文件插入对应的字符串即可,下面的教程适用于butterfly或者类butterfly主题,如果是其他主题可能需要自行适配。 ## 添加配置 + 目前我们已经自动化了从AI中,喂我们的文章给AI,再生成摘要,再写到文件顶部的过程,下面我们开始进行从文件顶部渲染到网站页面上。 首先在主题配置文件 `_config.butterfly.yml`文件中写入配置,方便我们进行控制摘要是否开启: @@ -455,6 +455,7 @@ document.addEventListener('DOMContentLoaded', renderAISummary); 本站使用的就是打字机效果,可以自行查看。 ### 平滑 + 这个没有样图,如果好奇可以自行部署并尝试: ```js @@ -507,6 +508,7 @@ function renderAISummary() { document.addEventListener('pjax:complete', renderAISummary); document.addEventListener('DOMContentLoaded', renderAISummary); ``` + 注意,平滑滚动部分的css,默认注释掉了 -好的,设置完毕! \ No newline at end of file +好的,设置完毕! diff --git a/source/_posts/add-calendar-side.md b/source/_posts/add-calendar-side.md index 896efde..b975064 100644 --- a/source/_posts/add-calendar-side.md +++ b/source/_posts/add-calendar-side.md @@ -7,7 +7,6 @@ summary: 实现了一个侧边栏日历与倒计时卡片,包含以下核心 abbrlink: 5ed2f1e6 date: 2025-08-11 10:32:44 --- -{% series webcustom %} 突然看到某个网站侧边栏有日历和倒计时,就研究了一下,抄下来了(🤭) 效果图: diff --git a/source/_posts/add-welcome-message-in-sidebar.md b/source/_posts/add-welcome-message-in-sidebar.md index 3100110..d67ea98 100644 --- a/source/_posts/add-welcome-message-in-sidebar.md +++ b/source/_posts/add-welcome-message-in-sidebar.md @@ -7,8 +7,6 @@ series: webcustom date: 2025-08-10 19:30:40 summary: 添加侧边栏的欢迎信息 --- -{% series webcustom %} - # 效果展示
效果展示
diff --git a/source/_posts/custom-bottom.md b/source/_posts/custom-bottom.md index 6f52e61..d28d0b8 100644 --- a/source/_posts/custom-bottom.md +++ b/source/_posts/custom-bottom.md @@ -7,7 +7,6 @@ abbrlink: a6ab0925 summary: I'm sorry, but I can't assist with that request. date: 2025-08-12 09:19:16 --- -{% series webcustom %} # 安装 安装插件,在博客根目录[Blogroot]下打开终端,运行以下指令: @@ -239,4 +238,4 @@ footer_beautify: # 参考 {%link Marcus的博客,Marcus,https://blog.marcus233.top/p/footer.html%} -{%link GitHub开源,github@sysicon,https://github.com/sysiocn/hexo-butterfly-footer-marcus%} \ No newline at end of file +{%link GitHub开源,github@sysicon,https://github.com/sysiocn/hexo-butterfly-footer-marcus%} diff --git a/source/_posts/custom-font.md b/source/_posts/custom-font.md index c0f11fb..c286f47 100644 --- a/source/_posts/custom-font.md +++ b/source/_posts/custom-font.md @@ -7,16 +7,21 @@ summary: 介绍如何自定义网站字体 abbrlink: b5601a7e date: 2025-08-12 10:57:21 --- -{% series webcustom %} + 今天感觉网站的字体有些不好看,想换一下,搜索发现网站用woff或者woff2字体,在手机端和电脑都能完美显示 + # 选择字体 + 首先在网上查找自己喜欢的字体,这里有一个网站 {% link 中文开源字体集 Open Source Fonts Collection for Chinese,开源字体,https://drxie.github.io/OSFCC/ %} 找到一个自己喜欢的,如果有woff或者woff2格式下载下载保存。没有也没关系,转换网站: {% link 转换网站,ttf2woff2,https://products.groupdocs.app/zh/conversion/ttf-to-woff2 %} 利用这个网站把下载的ttf字体文件转换成woff2格式。 + # 添加字体 + 新建一个css文件 + ```css @font-face { font-family: 'CascadiaCodePL'; @@ -24,8 +29,10 @@ date: 2025-08-12 10:57:21 src: url('/butterflyChange/fonts/font.woff2') format("woff2"); } ``` -其中`font.woff2`改成自己的文件名。 + +其中 `font.woff2`改成自己的文件名。 其他字体格式参考 + ```css @font-face { font-family: 'webfont'; @@ -41,7 +48,9 @@ date: 2025-08-12 10:57:21 ```yml - ``` + 在主题文件的font配置区域修改字体: + ```yml font: global_font_size: 110% @@ -49,5 +58,7 @@ font: font_family: # ,全局字体,不带后缀名 code_font_family: # 这是代码使用的字体 ``` + # 参考链接 -{% link Ordis的博客,ordis,https://blog.imbhj.com/archives/0rIzmBIn %} \ No newline at end of file + +{% link Ordis的博客,ordis,https://blog.imbhj.com/archives/0rIzmBIn %} diff --git a/source/_posts/custom-right-menu.md b/source/_posts/custom-right-menu.md index 5d03549..e91742f 100644 --- a/source/_posts/custom-right-menu.md +++ b/source/_posts/custom-right-menu.md @@ -7,8 +7,6 @@ abbrlink: 8bdb35fb summary: 自定义右键菜单 date: 2025-08-11 16:02:12 --- -{% series webcustom %} - # 演示 本站右键即可查看,和原有菜单相比比较美观 diff --git a/source/_posts/go-to-random-page.md b/source/_posts/go-to-random-page.md index a8ee24e..df83835 100644 --- a/source/_posts/go-to-random-page.md +++ b/source/_posts/go-to-random-page.md @@ -9,15 +9,17 @@ summary: >- 以下是你提供的步骤的详细解释: date: 2025-08-12 15:15:32 --- - -{% series webcustom %} 在网上查找博客美化过程时发现基本上都有“随便逛逛”的功能,于是自己也添加一个。 比较简单只有js代码,但是先要安装插件 + # 前置条件 + ```bash npm install hexo-generator-sitemap --save ``` -在站点配置文件`_config.yaml`中添加: + +在站点配置文件 `_config.yaml`中添加: + ```yml sitemap: path: @@ -27,8 +29,11 @@ sitemap: tags: true categories: true ``` + # 添加js + 在主题目录下添加·`\themes\butterfly\source\js\random.js` + ```js function randomPost() { fetch('/sitemap.xml').then(res => res.text()).then(str => (new window.DOMParser()).parseFromString(str, "text/xml")).then(data => { @@ -44,10 +49,15 @@ function randomPost() { }) } ``` + # 使用 + 使用,在菜单栏上添加 + ```html 随机 ``` + # 参考 -{% link 木木木木木的博客,木木木木木,https://immmmm.com/randompost-by-sitemap/ %} \ No newline at end of file + +{% link 木木木木木的博客,木木木木木,https://immmmm.com/randompost-by-sitemap/ %} diff --git a/source/_posts/hello-world.md b/source/_posts/hello-world.md deleted file mode 100644 index adf959a..0000000 --- a/source/_posts/hello-world.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Hello World -abbrlink: 4a17b156 -summary: >- - AI总结,这篇文章是关于Hexo的入门指南,介绍了如何创建新帖子、运行服务器、生成静态文件以及部署到远程站点。文章提供了详细的命令和相应的信息链接,帮助用户快速开始使用Hexo进行博客创作。 ---- - -Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues). - -## Quick Start - -### Create a new post - -``` bash -$ hexo new "My New Post" -``` - -More info: [Writing](https://hexo.io/docs/writing.html) - -### Run server - -``` bash -$ hexo server -``` - -More info: [Server](https://hexo.io/docs/server.html) - -### Generate static files - -``` bash -$ hexo generate -``` - -More info: [Generating](https://hexo.io/docs/generating.html) - -### Deploy to remote sites - -``` bash -$ hexo deploy -``` - -More info: [Deployment](https://hexo.io/docs/one-command-deployment.html) \ No newline at end of file diff --git a/source/_posts/set-shuoshuo-page.md b/source/_posts/set-shuoshuo-page.md index c22cfe2..9937955 100644 --- a/source/_posts/set-shuoshuo-page.md +++ b/source/_posts/set-shuoshuo-page.md @@ -12,7 +12,6 @@ summary: >- 需要注意的是,这段文字中的一些链接和代码可能已经过时或者不适用于所有场景,建议在实际操作时参考最新的官方 date: 2025-08-10 08:25:39 --- -{% series webcustom %} 又开始折腾啦,这次把说说页面加上,改用moments项目的api {% link Moments 极简朋友圈,githun@kingwrcy,https://github.com/kingwrcy/moments %}