之前使用 hexo 搭建博客的一些记录
# 教程
- https://hexo.io/ (opens new window)
- GitHub+Hexo 搭建个人网站详细教程 (opens new window)
- 史上最详细的Hexo博客搭建图文教程 (opens new window)
# Hexo简洁主题 :
- 大道至简——Hexo简洁主题推荐 (opens new window)
- https://github.com/tufu9441/maupassant-hexo (opens new window)
- Demo (opens new window)
# 多PC使用hexo
- 最完美的Hexo多电脑同步方法 (opens new window)
- 利用git解决hexo博客多PC间同步问题 (opens new window)
- 使用Hexo,如何在多台电脑上维护和更新github pages博客 (opens new window)
# 在Github 和 Gitee(开源中国)同时部署博客
说明,可以申请一个个人域名,然后通过CNAME映射到github上(yourname.github.io);需要特别说明的是,由于某些特殊原因,是无法将个人域名映射到开源中国的(yourname.gitee.io);备案域名应该可以。
# hexo 常用命令记录
hexo clean 清理
hexo g
生成博客hexo d 部署博客到github
以上三条可以这样写:
hexo clean && hexo g && hexo d
- hexo s / hexo s -p 5566 在本地4000(默认)/5566端口开启博客服务
...
# 重装系统之后,恢复编译环境。
Step1 安装 Node.js
Download | Node.js (opens new window)
安装Node.js会包含环境变量及npm的安装。
安装后,检测Node.js是否安装成功,在命令行中输入 node -v
查看版本号。
如果在 VS Code 中输入命令无效,需要先重启 VS Code.
检测npm是否安装成功,在命令行中输入 npm -v
.
Step2 使用 npm 安装 hexo
npm install hexo-cli -g
npm install hexo --save
Step3 安装依赖
在 hexo 博客目录中,运行 npm install
,会自动安装记录的依赖项。
到此,安装完成。 使用 hexo -v 检查安装是否成功。 如果提示错误,则按照提示进行,通常是:
npm rebuild node-sass --force
// --force 可以不加,如果出错,在加上试试。
Step4 配置 git user
如果发布时提示没有用户名,如果不想全局配置的话, 在 .deploy_git 文件夹中,可以单独运行命令配置 git user 信息。
Welcome to Hexo (opens new window)! This is your very first post. Check documentation (opens new window) for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting (opens new window) or you can ask me on GitHub (opens new window).
# Quick Start
# Create a new post
$ hexo new "My New Post"
More info: Writing (opens new window)
# Run server
$ hexo server
More info: Server (opens new window)
# Generate static files
$ hexo generate
More info: Generating (opens new window)
# Deploy to remote sites
$ hexo deploy
More info: Deployment (opens new window)