Skip to content

Commit

Permalink
New feature: replace
Browse files Browse the repository at this point in the history
  • Loading branch information
cjh0613 committed Aug 10, 2020
1 parent 2780578 commit 5dd7a62
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = function (locals) {
var count = config.hexo_submit_urls_to_search_engine.count;
var period = config.hexo_submit_urls_to_search_engine.period;
var urlsPath = config.hexo_submit_urls_to_search_engine.txt_path;
var cjh_replace = config.hexo_submit_urls_to_search_engine.replace;
if(submit_condition=='count'){
log.info("Generating urls for last " + count + " posts");

Expand All @@ -21,7 +22,13 @@ if(submit_condition=='count'){
})
.slice(0, count)
.map(function(post) {
return post.permalink
var cjhLink=post.permalink
if(cjh_replace==1){
var find_what = config.hexo_submit_urls_to_search_engine.find_what;
var replace_with = config.hexo_submit_urls_to_search_engine.replace_with;
cjhLink=cjhLink.replace(find_what,replace_with);
}
return cjhLink;
})
.join('\n');

Expand Down

0 comments on commit 5dd7a62

Please sign in to comment.