summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-06-08 02:02:55 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-06-08 13:07:20 -0500
commit7be19db42fd51da23b1ef658263897213b624500 (patch)
treea2bd4dfeffc7b1a8916580eb0eb7b8a5e56c6fa0 /lib
parente6daf1f899b412ded9a16674865b09f31fc7c75a (diff)
downloadgitlab-ce-7be19db42fd51da23b1ef658263897213b624500.tar.gz
Set target="_blank" for external links
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/external_link_filter.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/banzai/filter/external_link_filter.rb b/lib/banzai/filter/external_link_filter.rb
index 38c4219518e..27ca38e6d4a 100644
--- a/lib/banzai/filter/external_link_filter.rb
+++ b/lib/banzai/filter/external_link_filter.rb
@@ -15,6 +15,9 @@ module Banzai
next if link.start_with?(internal_url)
node.set_attribute('rel', 'nofollow noreferrer')
+
+ # Open external links on a new tab
+ node.set_attribute('target', '_blank')
end
doc