Hello World

Frankenadrixias’ Homepage

欢迎来到 Hexo!这是你的第一篇文章。查看 文档 以了解更多信息。如果你在使用 Hexo 时遇到任何问题,你可以在 故障排除 中找到答案,也可以在 GitHub 上问我。

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

OSCS Status

前置安装

安装 nodejs,然后通过 npm 安装 hexo

1
npm install -g hexo-cli

安装公式渲染器,然后再安装 pandoc

1
2
npm un hexo-renderer-marked
npm i hexo-renderer-pandoc

安装图片渲染器

1
2
npm i hexo-renderer-marked --save
npm i hexo-asset-img --save

启用下列设置,资源图片将会被自动解析为其对应文章的路径。

1
2
3
4
5
_config.yml
post_asset_folder: true
marked:
prependRoot: true
postAsset: true
1
2
3
4
5
6
7
8
9
10
例如:image.jpg 位置为 /2022/01/02/blog-test/image.jpg,
![](image.jpg) 将会被解析为 <img src="/2022/01/02/blog-test/image.jpg">
同时也可以用html方法:
<img src="image.jpg" width="50%"> 将会被解析为 <img src="/2022/01/02/blog-test/image.jpg" width="50%">

如果像设置图像的最小缩放宽度,可以用 style 样式:
<style>
.image{min-width: 600px}
img{object-fit: scale-down}
</style>

从2021年8月13日起,GitHub不再支持使用账户密码进行Git操作,需要使用个人访问令牌(Personal Access Token)或SSH密钥来替代。\

创建公钥,安装 git 部署插件,部署到 github 服务器

1
2
3
ssh-keygen -t rsa -C {key_name}  # 创建的公钥rsa.pub在github网页的设置中需要同步
npm install hexo-deployer-git --save
hexo clean && hexo g && hexo d # 清除已有生成、生成、部署

具体细节

新建博文 Create a new post
新创建的博文将会保存在 ./source/_posts/新建博文.md 目录下
More info: Writing

1
$ hexo new "My New Post"

运行本地服务器 Run server
More info: Server

1
$ hexo server
1
$ hexo s

生成静态页面 Generate static files
生成的静态界面位于 ./public/posts/新建博文.md 目录下
More info: Generating

1
$ hexo generate
1
$ hexo g

部署到远程服务器 Deploy to remote sites
More info: Deployment

1
$ hexo deploy

框架升级

升级npm

1
2
3
4
$ npm -v  # 查看npm版本
$ npm install -g n # 需要安装n模块,也可直接下载安装包更新Node.js
$ npm outdated # 列出需要更新的包
$ npm update
pic1

升级Hexo:通过npm命令升级版本

目前的Hexo稳定版本(适配插件):4.2.0 5.2.0 6.3.0 7.1.1

1
2
3
$ hexo -v  # 或者hexo --version
$ npm list hexo # 展示所有版本
$ npm install hexo@6.3.0 --save # 安装对应版本

更新主题:

1
2
3
4
$ npm install hexo-theme-next
up to date, audited 359 packages in 2s
$ npm view hexo-theme-next version
8.26.0