Skip to content

Instantly share code, notes, and snippets.

@eliezerb
Created July 11, 2013 19:40
Show Gist options
  • Save eliezerb/5978560 to your computer and use it in GitHub Desktop.
Save eliezerb/5978560 to your computer and use it in GitHub Desktop.
JavaScript function to make external links open in new tabs, using Jekyll without HTML explicit tag on markdown files.
// Make external links open in new tabs without target property in html
$('a').each( function( index , element ) {
if( !element.href.contains(document.location.host) ) {
element.target = '_blank';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment