hexo 第一讲 -- 从头开始搭建hexo
maoxf Lv2

hexo 第一讲

从头开始搭建hexo

安装node

node.js 官网

安装稳定版本

设置 git-ssh

本地生成公钥和密钥

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

第一个回车处可以看到该 .ssh 的路径

几个回车之后,生成公钥和密钥。可以避免频繁输入 git 账号和密码

github设置

github中设置 ssh

第一步中文件夹中的 id_rsa.pub 公钥复制到框中,取一个名字即可。

hexo本地安装启动

hexo中文官网

1
npm install hexo-cli -g

输入上述官网首页的命令,可以在指定文件夹中 init hexo

往下拉网页,可以看到如下命令

1
2
3
4
5
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo s -p 5555

则可以初步初始化 blog ,以及启动起来,在 localhost:5555

hexo发布到github

需要配置 hexo 的配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
title: maoxf小站
subtitle: 小站副标题
description: 小站小描述
keywords: maoxf
author: maoxf
language: zh-CN
timezone: Asia/Shanghai

url: https://hapitoku.github.io

deploy:
type: git
repo: https://github.com/hapitoku/maoxf-blog-source.git
branch: main

安装插件

根据 hexo部署文档 中的描述, 安装 hexo-deployer-git 。命令如下

1
npm install hexo-deployer-git --save

执行命令

1
2
hexo g
hexo d

输入账号密码以后,可以上传到 github 上。

到这一步,就可以访问 我的博客 啦。

下一节预警

下一节会将 hexo 选择主题 以及 自动部署。

  • 本文标题:hexo 第一讲 -- 从头开始搭建hexo
  • 本文作者:maoxf
  • 创建时间:2021-04-07 22:00:10
  • 本文链接:https://hapitoku.github.io/2021/04/07/blog/hexo/hexo 第一讲/
  • 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!