Make external links open in new tab (#892)

This commit is contained in:
Will Pearson 2019-01-13 16:05:41 -08:00 committed by Nolan Lawson
parent ef44c19e8a
commit cb35a088f4

View file

@ -111,6 +111,9 @@
} else if (anchor.getAttribute('rel') === 'nofollow noopener') { } else if (anchor.getAttribute('rel') === 'nofollow noopener') {
anchor.setAttribute('title', href) anchor.setAttribute('title', href)
} }
if (anchor.getAttribute('href')[0] !== '/' || anchor.getAttribute('href')[1] === '/') {
anchor.setAttribute('target', '_blank')
}
} }
stop('hydrateContent') stop('hydrateContent')
} }