hexo基本操作
- $ hexo \ c –> hexo\ clean $ 清空缓存
- $ hexo\ g –> hexo\ generate $ 生成网站静态文件到默认设置的public文件夹
- $ hexo\ d –> hexo\ deploy$ 自动生成网站静态文件,并部署到设定仓库
- $ hexo\ s –> hexo\ server $ 启动本地服务器
主题配置
下载主题文件到
themes文件夹修改站点配置文件
_config.yml找到 $ themes $ 这一行,修改为对应主体名字

部署网站
修改站点配置文件
_config.yml1
2
3
4
5#配置部署
deploy:
type: git # 规定
repository: https://github.com/0Jmins0/Jmins0.github.io.git #仓库地址
branch: main #规定1
2
3#配置url(否则部署到github上会显示不出来主题)
url: https://0jmins0.github.io/Jmins0.github.io
root: /Jmins0.github.io/根目录 $ hexo\ g + hexo\ d$ 部署到网站
加入数学插件
下载
mathjax1
npm install hexo-math --save
修改主题中的配置文件
_config.yml1
2enable: true
per_page: true在文章中打开
mathjax开关1
2
3
4---
title: hello word
mathjax: true
---
设置头像
- 在主题配置文件
_confid.yml中 找到avatar去掉注释启用 round设置为true——> 圆形头像- 将
next/images/avatar.gif替换为个人头像
设置标题、作者、连接
打开根目录的配置文件,位置如下:
1 | title: HiHi 的 Blog #标题 |
设置侧边栏社交链接
打开主题配置文件,将相应连接启用
1 | # Social Links |
首页设置阅读全文
方法一:在主题配置文件搜索auto_except ,将 enable 改为 true 。
方法二:在文章中间添加 <!--more-->,则语句前面显示在预览中。
添加动态背景
打开主题配置文件,搜索
canvas找到3D library下载需要的依赖,到
next/source/lib文件夹,并改名为three下载依赖
https://github.com/theme-next/theme-next-canvas-nest改名为canvas-nest修改主题配置文件
1
2
3
4
5
6
7
8
9
10# JavaScript 3D library.
# Dependencies: https://github.com/theme-next/theme-next-three
three:
enable: false
three_waves: false
canvas_lines: false
canvas_sphere: false
canvas_nest:
enable: true
添加评论功能
登录
leanCloud,并创建APP。找到
数据存储——结构化数据创建Class命名为Comment找到
设置-应用凭证分别复制AppIDAppKey到配置修改主题配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18# Valine
# For more information: https://valine.js.org, https://github.com/xCss/Valine
valine:
enable: true
appid: w0hgFFpgYXDb0kYsJiqe3NCG-gzGzoHsz
appkey: T65gVRVHNmIpYFP6QAUXbWB8
notify: false # Mail notifier
verify: false # Verification code
placeholder: Just go go # Comment box placeholder
avatar: mm # Gravatar style
guest_info: nick,mail,link # Custom comment header
pageSize: 10 # Pagination size
language: # Language, available values: en, zh-cn
visitor: true # Article reading statistic
comment_count: false # If false, comment count will only be displayed in post page, not in home page
recordIP: false # Whether to record the commenter IP
serverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)
#post_meta_order: 0只在文章界面设置评论功能,关闭标签页等页面的评论功能
1
comments: false//加在对应页面 .md文件的front matter中
添加搜索功能
添加插入图片功能
在博客根目录
_config.yml中,修改post_asset_folder:false为true在博客根目录打开
git bash here下载 :npm install hexo-asseet-image --save修改插件
- 路径:根目录 –>
node_modules–>hexo-asset-image–>index.js - 第58行,修改
$(this).attr('src', config.root + link + src);- 改成
$(this).attr('src', src);
- 路径:根目录 –>
在和文章并列的地方新建和文章同名的文件夹,并在里面存放要引用的照片
引用方法:
