安装
安装需确认你的 Hexo 版本在 3.0 以上,以及 Node 版本为 6.x 以上,在 Hexo 根目录,执行以下命令。
git clone git@github.com:yscoder/hexo-theme-indigo.git themes/indigo
目录结构如下

切换主题
执行
git branch
显示所有本地分支,如果只存在一个分支,可以执行下面的命令获取另一分支的主题。# 获取远程 card 分支,并切换 $ git checkout -b card origin/card # 获取远程 master 分支,并切换 $ git checkout -b master origin/master
此命令只需执行一次,之后使用
git checkout [branch]
命令在两个主题之间切换。依赖安装
还是在 Hexo 根目录,如果以下插件已安装过,无需再次安装。
- Less 主题默认使用 less 作为 css 预处理工具。
$ npm install hexo-renderer-less --save
- Feed 用于生成 rss。
$ npm install hexo-generator-feed --save
- Json-content 用于生成静态站点数据,用作站内搜索的数据源。
$ npm install hexo-generator-json-content --save
- QRCode 用于生成微信分享二维码。 可选,不安装时会请求 jiathis Api 生成二维码。
$ npm install hexo-helper-qrcode --save
页面添加
开启标签页
hexo new page tags
修改
hexo/source/tags/index.md
的元数据layout: tags comments: false ---
开启分类页
仅 card theme 支持。
hexo new page categories
修改
hexo/source/categories/index.md
的元数据layout: categories comments: false ---
至此官方文档的安装步骤 已经完成
启动服务报错
此时如果直接启动服务,控制台会打印以下错误
Unhandled rejection ReferenceError: /Users/tangly/Documents/WorkSpace/WEB/hexo/themes/indigo/layout/layout.ejs:6 4| <body> 5| <%- partial('_partial/loading') %> >> 6| <%- partial('_partial/menu') %> 7| <main id="main"> 8| <%- body %> 9| <%- partial('_partial/footer') %> /Users/tangly/Documents/WorkSpace/WEB/hexo/themes/indigo/layout/_partial/menu.ejs:27 25| menuItem = theme.menu[i]; 26| %> >> 27| <li class="waves-block waves-effect<% if(isActive(menuItem)){ %> active<% } %>"> 28| <a href="<%- url_for(menuItem.url) %>" <% if(menuItem.target){ %>target="_blank"<% } %> > 29| <i class="icon icon-lg icon-<%= i %>"></i> 30| <%=(menuItem.text || _.startCase(i)) %> _ is not defined at isActive (/Users/tangly/Documents/WorkSpace/WEB/hexo/themes/indigo/layout/_partial/menu.ejs:34:88) at eval (/Users/tangly/Documents/WorkSpace/WEB/hexo/themes/indigo/layout/_partial/menu.ejs:42:11) at menu (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/ejs/lib/ejs.js:682:17) at _View._compiledSync (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/hexo/lib/theme/view.js:132:24) at _View.renderSync (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/hexo/lib/theme/view.js:59:25) at Object.partial (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/hexo/lib/plugins/helper/partial.js:34:15) at eval (/Users/tangly/Documents/WorkSpace/WEB/hexo/themes/indigo/layout/layout.ejs:18:17) at layout (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/ejs/lib/ejs.js:682:17) at _View._compiled (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/hexo/lib/theme/view.js:136:50) at _View.render (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/hexo/lib/theme/view.js:39:17) at /Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/hexo/lib/theme/view.js:51:25 at tryCatcher (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/tangly/Documents/WorkSpace/WEB/hexo/node_modules/bluebird/js/release/promise.js:547:31)
问题原因
解决方法
1.执行
npm install lodash

2.在/node_modules/hexo/lib/hexo/index.js中增加两行代码

在
const { deepMerge, full_url_for } = require('hexo-util')
下面加一行const ***_*** = require('lodash');==

在
this.env = env;
下面加一行this._ = ***_***;

运行成功
