Merge pull request #131 from marcobiedermann/feature/external-links

fix #129 -external links
This commit is contained in:
Scott O'Hara 2016-07-05 17:53:57 -04:00 committed by GitHub
commit fd0a37515c
2 changed files with 12 additions and 3 deletions

View File

@ -8,9 +8,6 @@
<!-- <meta name="theme-color" content="#2980b9"> -->
<!-- <meta name="google-site-verification" content=""> -->
<!-- Open all links in a new tab/window -->
<base target="_blank">
<title>{% if page.title %}{{ page.title | xml_escape }}{% else %}{{ site.title | xml_escape }}{% endif %}</title>
<link rel="stylesheet" href="main.css">

View File

@ -32,6 +32,18 @@
sel.addRange(range);
};
// open external links in new tab
var links = document.links;
var linksLength = links.length;
var i = 0;
for (i = 0; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].rel = 'noopener noreferrer';
links[i].target = '_blank';
}
}
</script>
{% include analytics.html %}
</html>