Litreily / hexo-theme-snark

An hexo theme with lofter style
https://www.litreily.top
MIT License
72 stars 13 forks source link

运行错误 #1

Open joey998 opened 5 years ago

joey998 commented 5 years ago

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

Litreily commented 5 years ago

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

search:
    path: search.xml
    field: post
joey998 commented 5 years ago

_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;

Litreily commented 5 years ago

@joey998

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