hexo+github搭建自己的博客
爱吃鱼的猫 Lv2

准备工作

GitHub账号

注册一个github账号

GitHub申请账号

安装Git

Git安装(Windows)

安装NodeJS

NodeJS安装及配置(Windows)

创建仓库

  1. GitHub上创建一个新的代码仓库用于保存我们的网页。

点击Your repositories,进入仓库页面。

  1. 点击New按钮,进入仓库创建页面。
  2. 填写仓库名,格式必须为<用户名>.github.io,然后点击Create repository
  3. 访问我们的主页 https://djtang.github.io/

安装Hexo

采用Hexo来创建我们的博客网站,Hexo 是一个基于NodeJS的静态博客网站生成器,使用Hexo不需开发,只要进行一些必要的配置即可生成一个个性化的博客网站,非常方便。点击进入 官网

安装 Hexo

1
npm install -g hexo-cli

查看版本

1
hexo -v

创建一个项目 hexo-blog 并初始化

1
2
3
hexo init hexo-blog
cd hexo-blog
npm install

本地启动

1
2
hexo g
hexo server

更换主题

官网推荐主题

我使用的是Keep

创建文章

1
hexo new post 测试文章

发布到GitHub Pages

安装hexo-deployer-git

1
npm install hexo-deployer-git --save

修改根目录下的 _config.yml,配置 GitHub 相关信息

1
2
3
4
5
deploy:
type: git
repo: https://github.com/yaorongke/yaorongke.github.io.git
branch: main
token: ghp_3KakcaPHerunNRyMerofcFd9pblU282FSbsY

静态图片

使用PicX图床

参考:

[1]: https://blog.csdn.net/yaorongke/article/details/119089190 “GitHub Pages + Hexo搭建个人博客网站,史上最全教程”
[2]: https://keep-docs.xpoet.cn/usage-tutorial/quick-start.html “hexo-theme-keep”

  • Post title:hexo+github搭建自己的博客
  • Post author:爱吃鱼的猫
  • Create time:2022-04-26 18:40:56
  • Post link:https://djtang.github.io/2022/04/26/hexo+github搭建自己的博客/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.
 Comments