博客搭建

第一步:基本环境/工具

注意:nodejs 和 git 建议安装在C盘
nodejs官网:https://nodejs.org/zh-cn/

git官网:https://www.gitclone.com/docs/feature/github_git

vscode官网:https://code.visualstudio.com/

安装cnpm请在git bash中安装,切换国内源,安装更快

1
cnpm install -g cnpm --registry=https://registry.npmmirror.com

安装hexo请在git bash 安装

1
cnpm install hexo-cli -g

第二步:创建本地博客

  1. 创建一个文件夹
  2. Hexo框架初始化(打开git bash执行)
1
hexo init

第三步:安装主题

每个主题的安装方式需要大家阅读主题文档,我们这里以Butterfly主题为例子

主题演示网站:https://butterfly.js.org/

主题使用文档:https://butterfly.js.org/posts/21cfbf15/#%E5%AE%89%E8%A3%9D

第四步:创建Github仓库

  1. 注册github后创建1个仓库

  2. 在网站配置文件添加ssh链接

1
2
3
4
deploy:
type: git
branch: main
repo: git@github.com:Frost-001/Frost-001.github.io.git

第五步:配置密钥信息

生成SSH:

1
ssh-keygen -t rsa -C “邮箱“

验证信息:

1
2
git config --global user.name "英文名字"
git config --global user.email "邮箱"

第六步:上传博客

1
npm install hexo-deployer-git --save
1
hexo g -d

最后一步:获取网址及绑定自己的域名

| vercel: https://vercel.com/dashboard

主要作用:

  1. 让国内可以正常访问
  2. 使网址方便记忆及个性化