hexo-theme-snark icon indicating copy to clipboard operation
hexo-theme-snark copied to clipboard

运行错误

Open joey998 opened this issue 6 years ago • 3 comments

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

joey998 avatar May 30 '19 10:05 joey998

请问你的博客根目录下的_config.xml文件中有配置search参数吗?

search:
    path: search.xml
    field: post

Litreily avatar May 30 '19 13:05 Litreily

_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 avatar May 30 '19 13:05 joey998

@joey998

  1. _config.yml, 默认没有search参数,可以手动添加,就按我上面给的样式添加即可。不过按理说加不加都不会有影响,这个我是有测试过的,你添加上试试;
  2. 至于search.xml,它不是配置文件,是hexo会根据配置自动生成的一个搜索数据库,不需要配置;
  3. 还有个问题,如果你想使用local_search功能,需要安装npm install hexo-generator-search --save,这个在README中有说明。

Litreily avatar May 31 '19 07:05 Litreily