# hexo 博客安装
安装 nodejs
安装 git
安装 hexo(windows 需进入 git bash)
npm install -g hexo-cli
初始化博客目录
hexo init blog
进入博客目录
cd blog
初始化 hexo 到博客目录
npm install
# shoka 主题安装
下载主题
git clone
https://github.com/amehime/hexo-theme-shoka.git./themes/shoka
卸载 hexo-renderer-marked 以及别的 markdown 文件渲染器
npm un hexo-renderer-marked --save
安装(md 文件渲染器,压缩 css/js/html)
npm i hexo-renderer-multi-markdown-it --save
安装(给生成的 css 文件们添加浏览器前缀)
npm i hexo-autoprefixer --save
安装(站内搜索功能)
npm i hexo-algoliasearch --save
安装(文章或站点字数及阅读时间统计)
npm i hexo-symbols-count-time --save
安装(生成 Feed 文件)
npm i hexo-feed --save
# Hexo 部分常用命令
清除静态文件
hexo clean
生成静态文件
hexo g
安装 git 推送插件
npm install hexo-deployer-git --save
推送静态文件到 git
hexo d
# 安装 hexo-admin(编写博客插件)
npm install hexo-admin --save
hexo-admin 编辑 url
settings 设置用户名、密码、Secret
把底部生成的配置拷入 hexo 配合文件中 (_config.yml)
admin: | |
username: username | |
password_hash: xxxxxx | |
secret: 'my super secret phrase' #用单引号包裹 | |
deployCommand: 'hexo-publish.sh' #windows 用 hexo-publish.bat,linux 用 hexo_publish.sh |
# hexo_publish.sh
#!/bin/bash | |
hexo clean | |
hexo g | |
hexo d |
# hexo_publish.bat
@echo off | |
cd D:\blog | |
d: | |
@cmd /c "hexo clean&& hexo g&&hexo d&&echo success" |