简介:这是一个可以快速搭建自己的博客的开源项目,其中有很多主题选择。
前置准备
需要提前装上 node.js (要高于12.0版本) & git
然后执行以下的指令
npm install -g hexo-cli —> 安装hexo的cli
hexo init <folder> —> 初始化hexo项目
cd <folder> —> 进入项目
npm install --> 再次安装
项目结构说明
_config.yml —> 配置文件在这里
package.json —> 配置说明书,用了哪些插件,主题,生成器,渲染器,版本…
scaffolds —> 这里放的是文章的模板
source —> 放写的文章的地方
themes —> 存放网站的主题
Commands
hexo init [folder] --> 这个初始化一个hexo项目
hexo new [layout] <title> --> 创建一个新文章
hexo g == hexo generate 生成静态文件
hexo s == hexo server 启动本地服务器
hexo clean 清理public中文件和 db.json
hexo d 快速部署
- 如果是部署到github,需要先安装插件
npm install hexo-deployer-git --save - 配置_config.yml中的deploy段落
deploy:
type: git
repo: https://github.com/memorycx/blog.git
branch: gh-pages
Themes
这里以我使用的 typing 为例
cd your-blog
git clone https://github.com/geekplux/hexo-theme-typing themes/typing
然后将根目录中的_config.yml的theme修改为typing
修改之后,运行如下命令,应该主题就改好了
hexo clean
hexo g
hexo s //本地查看
hexo d //推到远程
github仓库中的一些设置
在你的博客仓库中,打开setting,然后点击左侧的pages
将Build and deployment 下面的 Source 改成 Deploy from a branch;
将Branch 中选成 gh-pages /(root)
然后点击保存
2865

被折叠的 条评论
为什么被折叠?



