diff --git a/src/postTools.js b/src/postTools.js index 2850b666bf..940c39d256 100644 --- a/src/postTools.js +++ b/src/postTools.js @@ -148,14 +148,18 @@ var RDB = require('./redis.js'), if (md.length > 0) { var parsedContentDOM = cheerio.load(marked(md)); - parsedContentDOM('a').attr('rel', 'nofollow'); - - var href = parsedContentDOM('a').attr('href'), - domain = global.nconf.get('url'); + var domain = global.nconf.get('url'); + + parsedContentDOM('a').each(function() { + this.attr('rel', 'nofollow'); + var href = this.attr('href'); - if (href && !href.match(domain)) { - parsedContentDOM('a').attr('href', domain + 'outgoing?' + href); - } + if (href && !href.match(domain)) { + this.attr('href', domain + 'outgoing?' + href); + this.append(' '); + } + }); + html = parsedContentDOM.html(); } else {