Skip to content

Commit ca3a8eb

Browse files
committed
External links open in new tab
1 parent e3a38b4 commit ca3a8eb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

_layouts/default.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,14 @@
133133
ga('send', 'pageview');
134134
</script>
135135

136+
<script>
137+
document.querySelectorAll('a[href^="http"]').forEach(function(link) {
138+
if (link.hostname !== window.location.hostname) {
139+
link.setAttribute('target', '_blank');
140+
link.setAttribute('rel', 'noopener');
141+
}
142+
});
143+
</script>
144+
136145
</body>
137146
</html>

0 commit comments

Comments
 (0)