tea3 / hexo-related-popular-posts

A hexo plugin that generates a list of links to related posts and popular posts. Also , this plugin can get Visitor Counts (PV) on posts.
MIT License
111 stars 15 forks source link

Set the update check settings to false about negativeKeywordsList and googleAnalyticsData when cache setting is disable #7

Closed yoshinorin closed 7 years ago

yoshinorin commented 7 years ago

Enviroment

Problem

Sometime below error occurs when save post file in developer mode (hexo server command), if hexo-related-popular-posts cache setting is disable.

Cannot read property 'path' of undefined
    at Object.module.exports.getList (D:\blog\1_main\node_modules\hexo-related-popular-posts\lib\list-json.js:41:80)
    at module.exports (D:\blog\1_main\node_modules\hexo-related-popular-posts\lib\helper-json.js:6:19)
    at Object.<anonymous> (D:\blog\1_main\node_modules\hexo-related-popular-posts\index.js:173:37)
    at Object.wrapper [as popular_posts_json] (D:\blog\1_main\node_modules\lodash\lodash.js:4968:19)
    at eval (eval at compile (D:\blog\1_main\node_modules\hexo-renderer-ejs\node_modules\ejs\lib\ejs.js:1:0), <anonymous>:89:29)
    at returnedFn (D:\blog\1_main\node_modules\hexo-renderer-ejs\node_modules\ejs\lib\ejs.js:580:17)
    at _compiledSync (D:\blog\1_main\node_modules\hexo\lib\theme\view.js:122:20)
    at View.renderSync (D:\blog\1_main\node_modules\hexo\lib\theme\view.js:50:21)
    at Object.partial (D:\blog\1_main\node_modules\hexo\lib\plugins\helper\partial.js:42:17)
    at Object.wrapper (D:\blog\1_main\node_modules\lodash\lodash.js:4968:19)
    at eval (eval at compile (D:\blog\1_main\node_modules\hexo-renderer-ejs\node_modules\ejs\lib\ejs.js:1:0), <anonymous>:9:17)
    at returnedFn (D:\blog\1_main\node_modules\hexo-renderer-ejs\node_modules\ejs\lib\ejs.js:580:17)
    at _compiled (D:\blog\1_main\node_modules\hexo\lib\theme\view.js:127:30)
    at View.render (D:\blog\1_main\node_modules\hexo\lib\theme\view.js:29:15)
    at D:\blog\1_main\node_modules\hexo\lib\hexo\index.js:390:25
    at tryCatcher (D:\blog\1_main\node_modules\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at D:\blog\1_main\node_modules\hexo\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (D:\blog\1_main\node_modules\hexo\lib\hexo\router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:348:10)
    at resume_ (_stream_readable.js:737:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Reason

In the current source code(index.js), update check default setting about negativeKeywordsList and googleAnalyticsData are true. And these setting never change to false, if hexo-related-popular-posts cache setting is disable.

Solution

Set the update check settings to false about negativeKeywordsList and googleAnalyticsData when cache setting is disable.

tea3 commented 7 years ago

@YoshinoriN Thank you for your advice. Please update npm version :D