Hexo框架快速上手

Hexo框架使用说明

使用淘宝镜像源加速 NPM

npm config set registry https://registry.npmmirror.com

参考:https://blog.csdn.net/qq_43940789/article/details/131449710

使用 npm 一键安装 Hexo 博客程序

npm install -g hexo-cli

参考:https://zhuanlan.zhihu.com/p/60578464

初始化并安装所需组件

1
2
hexo init      # 初始化
npm install # 安装组件

完成后依次输入下面命令,启动本地服务器进行预览

1
2
hexo g   # 生成页面
hexo s # 启动预览

访问 http://localhost:4000,出现页面,本地博客安装成功!

部署 Hexo 到网站

参考:https://blog.csdn.net/qingmuzhang/article/details/119906728

安装 hexo-deployer-git:

npm install hexo-deployer-git --save

hexo d 部署

需要安装的一些依赖

为文章添加目录(现弃用,有bug)

参考为文章添加目录

  1. 安装插件

npm install hexo-toc --save

  1. 配置博客根目录下的_config.yml文件
1
2
toc:
maxdepth: 3
  1. 添加目录

在需要展示目录的地方添加:

<!-- toc -->

一键开发

hexo clean && hexo g && hexo s

一键部署

hexo clean && hexo g && hexo d

以下是建站之后,Hexo的默认提供的快速使用

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment


Hexo框架快速上手
https://camill.love/getting-started/hello-hexo/
作者
Camill
发布于
2024年1月14日
更新于
2024年1月17日
许可协议