0. 安装前提
Windows系统下安装 Hexo,需要先安装下列应用程序。
1. 安装、初始化 Hexo
创建新 post,新建的 post 文件位于source/_posts
文件夹内。
2. 服务器
首先安装hexo-server,运行服务器。
网站会在 http://localhost:4000 下启动。
3. 更换主题
在终端窗口下,定位到 Hexo 站点目录下。使用 Git checkout 主题代码。
打开站点配置文件blog/_config.yaml
,找到 theme 字段,并将其值更改为 next。
运行服务器,验证主题是否正确启用。
3.1 主题配置
打开主题配置文件hexo/themes/next/_config.yml
,更改Scheme字段。
3.2 更新主题
打开主题配置文件夹`hexo/themes/next’。
4. 站点配置
打开站点配置文件._config.yaml
,更改相关字段。
5. Git 配置
打开git bash,设置用户名,并生成ssh-key
。
复制~/.ssh/id_rsa.pub
,在 github 个人设置页面,点击新建或添加 SSH key,将id_rsa.pub
内容复制进去。
测试 git 客户端与 github 是否连接成功。
如果连接报错ssh: connect to host github.com port 22: Connection > refused
打开/新建~/.ssh/config
,修改内容如下,重新测试。
如果连接报错"Deployer not found: git"
,安装hexo-deployer-git。