安装nvm
https://github.com/coreybutler/nvm-windows/releases
https://github.com/coreybutler/nvm-windows
安装npm
https://blog.csdn.net/qq_31594665/article/details/135750276
查看已经安装库
npm list --depth 0
git
https://gist.github.com/laispace/666dd7b27e9116faece6
其它主题
https://www.cnblogs.com/v1coder/p/16368938.html
安装icarus【建议直接新安装+迁移博客】
https://github.com/ppoffice/hexo-theme-icarus
https://baldstrong.github.io/2022/02/21/hexo使用icarus主题/
https://github.com/ppoffice/hexo-theme-icarus/discussions/1091
https://github.com/npm/cli/releases/tag/v6.14.18
https://github.com/ppoffice/hexo-theme-icarus/discussions/1091
https://blog.csdn.net/chengliang666/article/details/119572250
https://blog.csdn.net/Desiy/article/details/107172844
https://github.com/ppoffice/hexo-theme-icarus/releases
card
https://blog.csdn.net/gitblog_00288/article/details/144237534
hexo重要文件介绍
1、search.xml 【hexo-generator-search】生成的索引文件, 通过http://localhost:4000/search.xml可以访问
位置:blog\public\search.xml
生成的检索内容
2、content.json 【hexo-generator-json-content】生成的索引文件
位置:blog\public\content.json
用于检索的文件
3、silder
源码:blog\themes\yilia\source-src\js\slider.js
编译后:blog\themes\yilia\source\slider.e37972.js
前端:blog\themes\yilia\layout_partial\tools.ejs
4、blog配置:blog_config.yml
5、yilia配置:blog\themes\yilia_config.yml
smart_menu:
innerArchive: ‘search’ #kzy yilia自带的search
yilia 搜索【亲测ok】
- 逻辑:
1、blog\themes\yilia_config.yml 开启text, 让content.json存储text字段
1 | jsonContent: |
2、blog\public\content.json 博客内容会缓存在这
3、修改
3.1 blog\themes\yilia\source-src\js\slider.js 【修改源码,没用】
3.2 blog\themes\yilia\source\slider.e37972.js 【修改编译后的代码,有用】
1 | var r=!1;e.title.toLowerCase().indexOf(t)>-1&&(r=!0); |
search方法一【亲测不ok,搜索没反应】
0、参考:
https://yansheng836.github.io/article/915f21c1.html
https://github.com/barretlee/hexo-search-plugin-snippets
https://waxadesign.com/playground/web/hexo-local-search/
1、安装hexo-generator-search,生成search.xml索引
1 | npm install hexo-generator-search --save |
2、配置全局_config.yml 【不配置也行】
1 | _config.yml添加 |
3、layout添加搜索框
在blog\themes\yilia\layout\layout.ejs的
1 | <div class="page-header" style=""> |
4、添加引入样式:
4.1、blog\themes\yilia\source下新建样式文件search.css
1 | .local-search { |
4.2、在页面引入样式文件,在blog\themes\yilia\layout_partial\css.ejs添加如下代码:
1 | <link rel="stylesheet" type="text/css" href="<%=config.root%>./search.css"> |
4.3、在themes\yilia\source\main.0cf68a.css,添加如下代码(为了挪位置)
1 | /* 页面头部:站内搜索 */ |
5、在blog\themes\yilia\source\下新建js\search.js,添加如下代码:
1 | // A local search script with the help of hexo-generator-search |

search方式二【亲测ok】【有点丑】
1、hexo new page find
2、修改blog\source\find\index.md
type: “find”
layout: “find”
3、修改blog\themes\yilia_config.yml
find: /find
4、新建blog\themes\yilia\layout\find.ejs,添加搜索框
5、添加引入样式:
5.1、blog\themes\yilia\source下新建样式文件search.css【同第一种步骤4.1】
5.2、在页面引入样式文件,在blog\themes\yilia\layout_partial\css.ejs添加如下代码【同第一种步骤4.2】:
1 | <link rel="stylesheet" type="text/css" href="<%=config.root%>./search.css"> |
6、在blog\themes\yilia\source\下新建js\search.js【同第一种步骤5】

github配置多个hexo网站
- 本地新建项目
- github新建项目
- _config.yaml配置+hexo d
- github打开项目->setting->page->修改source->出现&编辑Custom domain->访问失败->删除Custom domain->出现https://AAA.github.io/BBB/
- github打开项目->setting->page->修改branch->出现Custom domain->访问失败->出现https://AAA.github.io/BBB/
使用matery主题
修改1、参考说明修改
https://github.com/blinkfox/hexo-theme-matery/blob/develop/README_CN.md
- 配置页面:categories、tags、about、contact、friends、404页面
- 配置friends内容:
- 博客的source/_data/friends.json
- 代码高亮【未研究】
- 搜索【ok】
- 安装npm install hexo-generator-search --save
- 博客的_config.yml修改
- 中文链接转拼音【未研究】
- 添加emoji表情支持【未研究】
- 添加 RSS 订阅支持【未研究】
- 在线聊天功能【未研究】
- 修改网站页脚【未研究】
- 主题的/layout/_partial/footer.ejs
- 添加中文繁简转换【未研究】
- 修改社交链接,修改主题的_config.yml的socialLink内容
- 主题的/layout/_partial/social-link.ejs
- 添加note【未研究】
- 文章Front-matter介绍【部分研究】
- summary: 卡片
- top: true首页推荐区域放置文章
- hide: true首页不出现文章
- toc: false关闭目录
- password: 该值必须是用 SHA256 加密后的密码【没成功】
- cover: true表示该文章加入到首页轮播封面
- coverImg: 表示该文章在首页轮播封面需要显示的图片路径,如果没有,则默认使用文章的特色图片
- 主题颜色
- 主题的/source/css/matery.css 搜索 .bg-color 来修改背景颜色
/* 整体背景颜色,包括导航、移动端的导航、页尾、标签页等的背景颜色. */
.bg-color {
background-image: linear-gradient(to right, #4cbf30 0%, #0f9d58 100%);
}
#4cbf30 -> #df933c
#0f9d58 -> #d39013
#42b983 -> #b97b42
#5cb85c -> #b8935c - 主题的/source/css/poss.css 修改目录颜色
- 主题的/source/css/matery.css 搜索 .bg-color 来修改背景颜色
- 修改banner图:
- 主题的/source/medias/banner,每天一张7张即可
修改2、修改themes/matery/_config.yaml
- 图片位置:【ok】
- 打赏:主题的source/medias/reward/weixin_pay.png
- 头像:主题的source/medias/avatar.jpg
- 个人相册myGallery: 主题的source/medias/featureimages 前3张?
- 封面视频:
- 文章封面图片:
- featureImages【ok】修改文章特色图,用于轮播和封面
- 主题的/source/medias/featureimages,24张,选哟在_config.yml做同步修改featureImages
- 二级菜单【ok】
- 站点运行时间【ok】
- 首页封面轮播图的相关配置【ok】
- 配置首页显示"梦想"的语句【ok】
- 音乐播放器 【ok】
- video 【未启用】
- recommend 【未启用】
- 第二个按钮的配置 【ok】
- 首页banner的配置 【ok】
- 代码块相关 【未启用】
- reward 【ok】
- copyright 【未启用】
- mathjax 【未启用】
- 文章信息 【ok】
- 文章字数统计,要安装npm i --save hexo-wordcount
- 点击效果 【ok】
- 个人页面【ok】
- 个人项目【未启用】
- 个人技能【ok】
- 个人相册【ok】
- 归档-日历显示【ok】
- 评论【未启用】
- 右上角连接githubLink【ok】
- 文章加密verifyPassword【未激活】:
- 和文章front信息,password有关
- 人数统计【?】
- 谷歌、百度搜索【未启用】
- 百度搜索资源平台提交链接【ok】
- 文章封面图片【ok】
- 转载规则【未启用】
- 文章分享模块【ok】
- 副标题【ok】
- 手机二级菜单【未启用】
- 网页预加载【ok】
- banner每日切换【ok?】
- enable使用banner图片,random使用featureimages图片
- 中文繁简转换开关【未启用】
- 网站背景图【未启用】
search
-
Hexo 根目录下的 _config.yml 文件
说明:https://github.com/wzpan/hexo-generator-search
search:
path: search.xml
field: post
content: true
template: ./search.xml -
找到Hexo 主题目录下的 layout/search.xml (或 layout/search.json) 文件,这是生成搜索文件的模板。
没找到 -
hexo clean & hexo g 生成新的缓存文件
-
public\search.xml
添加: -
对比themes\hexo-theme-matery\layout\category.ejs
- img
- 正常逻辑:找img标签,找不到就从轮播图找
- 搜索逻辑:search.xml的文章第一个img,找不到就从轮播图找
- 最终搜索逻辑:找img标签,找不到就从轮播图找
- summary
- 正常逻辑:找summary标签,没有就前120字(0字)
- 改了不显示:<%- strip_html(post.content).substring(0, 0) %>
- 搜索逻辑:search.xml的文章前几行
- 最终搜索逻辑:找summary标签
- 正常逻辑:找summary标签,没有就前120字(0字)
- tag、category、title、url
- 和其它一样,提取内容
- category
- 正常逻辑:如果没有,则显示author
- 搜索逻辑:只显示category, category少了链接,搜索使用span,正常使用a
- 最终搜索逻辑:补充点击跳转
- tag
- 搜索逻辑:tag少了链接,搜索使用span,正常使用a
- 最终搜索逻辑:补充点击跳转
- updated
- 和其它一样,提取内容, search.xml没有
- 最终搜索逻辑:改成date
- img
-
修改
- 1、修改模板 cookbook\node_modules\hexo-generator-search\templates\search.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17{% if post.summary and post.summary.length>0 %}
<summary>
{{ post.summary }}
</summary>
{% endif %}
{% if post.date %}
<date>
{{ post.date }}
</date>
{% endif %}
{% if post.img %}
<img>
{{ url + post.img }}
</img>
{% endif %}- 2、hexo clean & hexo g
- 3、查看生成文件 cookbook\public\search.xml
- 4、修改实现 cookbook\themes\hexo-theme-matery\layout\find.ejs
- 对比:cookbook\themes\hexo-theme-matery\layout\category.ejs
-
待完善
- 搜索
- 新建搜索页面 【ok】
- 搜索实现 【ok】
- 博文属性配置 【ok】
- 搜索翻页【不会】
- 长度不一致【不会】
- 目录
- 目录颜色 post.css修改【ok】
- 手机目录【ok】cookbook\themes\hexo-theme-matery\layout_partial\post-detail-toc.ejs 把属性hide-on-med-and-down去掉
- 其它
- 去到底部 【不会】
- 搜索