mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Converted all link tags in preview to open in new tab
no issue
This commit is contained in:
parent
90f61d1f04
commit
52eb3ca9da
1 changed files with 7 additions and 1 deletions
|
@ -3,6 +3,7 @@ const template = require('./template');
|
|||
const settingsCache = require('../../services/settings/cache');
|
||||
const urlUtils = require('../../lib/url-utils');
|
||||
const moment = require('moment');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const getSite = () => {
|
||||
return Object.assign({}, settingsCache.getPublic(), {
|
||||
|
@ -17,9 +18,14 @@ const serialize = (post) => {
|
|||
if (post.posts_meta) {
|
||||
post.email_subject = post.posts_meta.email_subject;
|
||||
}
|
||||
let juicedHtml = juice(template({post, site: getSite()}));
|
||||
// Force all links to open in new tab
|
||||
let _cheerio = cheerio.load(juicedHtml);
|
||||
_cheerio('a').attr('target','_blank');
|
||||
juicedHtml = _cheerio.html();
|
||||
return {
|
||||
subject: post.email_subject || post.title,
|
||||
html: juice(template({post, site: getSite()})),
|
||||
html: juicedHtml,
|
||||
plaintext: post.plaintext
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue