# hexo 博客安装

  1. 安装 nodejs

  2. 安装 git

  3. 安装 hexo(windows 需进入 git bash)

    npm install -g hexo-cli

  4. 初始化博客目录

    hexo init blog

  5. 进入博客目录

    cd blog

  6. 初始化 hexo 到博客目录

    npm install

# shoka 主题安装

  1. 下载主题

    git clone https://github.com/amehime/hexo-theme-shoka.git ./themes/shoka

  2. 卸载 hexo-renderer-marked 以及别的 markdown 文件渲染器

    npm un hexo-renderer-marked --save

  3. 安装(md 文件渲染器,压缩 css/js/html)

    npm i hexo-renderer-multi-markdown-it --save

如果出现安装报错的情况,可使用 yarn 进行安装
npm install -g yarn #安装 yarn
yarn config set registry https://registry.npm.taobao.org #使用淘宝源
yarn add hexo-renderer-multi-markdown-it

  1. 安装(给生成的 css 文件们添加浏览器前缀)

    npm i hexo-autoprefixer --save

  2. 安装(站内搜索功能)

    npm i hexo-algoliasearch --save

  3. 安装(文章或站点字数及阅读时间统计)

    npm i hexo-symbols-count-time --save

  4. 安装(生成 Feed 文件)

    npm i hexo-feed --save

# Hexo 部分常用命令

  • 清除静态文件

    hexo clean

  • 生成静态文件

    hexo g

  • 安装 git 推送插件

    npm install hexo-deployer-git --save

  • 推送静态文件到 git

    hexo d

# 安装 hexo-admin(编写博客插件)

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"
更新于 阅读次数

请我喝[茶]~( ̄▽ ̄)~*

Hito Li 微信支付

微信支付

Hito Li 支付宝

支付宝