hexo-theme-snark
hexo-theme-snark copied to clipboard
运行错误
Unhandled rejection TypeError: G:\git\hexo-demo\myblog\themes\snark\layout_partial\after-footer.pug:10 8| if theme.local_search == true 9| script.
10| var search_path = '#{config.search.path}'; 11| if (search_path.length == 0) { 12| search_path = 'search.xml'; 13| }
Cannot read property 'path' of undefined
请问你的博客根目录下的_config.xml文件中有配置search参数吗?
search:
path: search.xml
field: post
是_config.yml文件吧?我文件里面没有search参数属性,而且我得根目录里面没有search.xml这个配置文件,需要怎么配置呢?求教老哥(^-^)
我是按照官网配置来的
hexo init
hexo install
git clone https://github.com/litreily/hexo-theme-snark.git themes/snark
npm install hexo-renderer-pug --save
npm install hexo-renderer-sass --save
然后把根目录的theme改成snark;
@joey998
- 是
_config.yml, 默认没有search参数,可以手动添加,就按我上面给的样式添加即可。不过按理说加不加都不会有影响,这个我是有测试过的,你添加上试试; - 至于
search.xml,它不是配置文件,是hexo会根据配置自动生成的一个搜索数据库,不需要配置; - 还有个问题,如果你想使用
local_search功能,需要安装npm install hexo-generator-search --save,这个在README中有说明。