skip to Main Content

I’m self-taught/totally new to Jekyll and Github Pages and was wondering how to go about opening a URL in a new tab with markdown in the config.yml page.

This is the website theme I’m using. I want the last ‘github’ link to open in a new tab, instead of the default, which is opening in the current tab.

The _config.yml looks like this:

# # # # # # # # # # # # #
#   K i k o - p l u s   #
# # # # # # # # # # # # #

# Basic
name:         "Kiko Plus"

author:
facebook:         your-id
youtubeUser:      your-id
youtubeChannel:   your-id
twitter:    your-id
github:     your-id
stackoverflow:    your-id
quora:      your-id
linkedin:         your-id
pinterest:        your-id
googlePlus:       your-id
instagram:        your-id
reddit:     your-id
medium:     your-id
tumblr:     your-id
email:      [email protected]

copyright:
year:       2017
name:       Kiko

# Google-analytics
google-analytics:
id:         ""

# Disqus
disqus:
id:         "kiko-plus"

# URL
url:          "https://AWEEKJ.github.io" # the base 
hostname & protocol for your site
# url:          "http://localhost:4000" # use this url when 
you develop
baseurl:      "/Kiko-plus" # the subpath of your site


# http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
timezone:     Asia/Seoul
permalink:    /:year-:month-:day/:title/

# Pagination
paginate:     5
paginate_path:      /page:num/

# Markdown
markdown:     kramdown
kramdown:
input:      GFM

# Navigation
nav:
- name:     "About"
  url:      "/about"
- name:     "Archive"
  url:      "/archive"
- name:     "Tags"
  url:      "/tags"
- name:     "Github"
  url:      "https://github.com/AWEEKJ/Kiko-plus"

# Sass
sass:
sass_dir:         _sass
style:      :compressed

# Scopes
defaults:
-
  scope:
    path:         ""
    type:         "pages"
  values:
    layout:       "page"
-
  scope:
    path:         ""
    type:         "posts"
  values:
    layout:       "post"

# jekyll-seo-tag, 
gems:
- jekyll-seo-tag
- jekyll-paginate
- jekyll-admin

exclude:      [vendor]

To do this in any basic markdown post, naturally you’d do

[a link](http://example.com){:target="_blank"}

But since this link is in the site setup, that doesn’t work. I’ve searched a ton and tried 5 or 6 different recommendations but to no avail.

Any ideas? Would be uber appreciated!!!!

3

Answers


  1. You need to add target="_blank" to index.html line 12 as follow:

     <a href="{{ nav.url }}" target="_blank">{{ nav.name }}</a>
    
    Login or Signup to reply.
  2. I found a plugin that automatically sets any external URL to open in a new tab:

    https://rubygems.org/gems/jekyll-target-blank

    Add the following to your site’s Gemfile

    gem 'jekyll-target-blank'
    

    and add the following to your site’s
    _config.yml

    plugins:
      - jekyll-target-blank
    

    You may also need to run bundle install to install the new Gem

    Login or Signup to reply.
  3. {:target="_blank"} works for me:

    [text](http://url){:target="_blank"}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search