如何在Jekyll / Github页面站点的config.yml中的新选项卡中打开URL?

时间:2017-07-10 04:36:29

标签: jekyll github-pages jekyll-extensions jekyll-bootstrap jekyll-paginator

我是自学/全新的Jekyll和Github Pages,并且想知道如何在config.yml页面中使用markdown在新选项卡中打开URL。

This是我正在使用的网站主题。 我希望最后一个'github'链接在 new 标签中打开,而不是在当前标签页中打开的默认值。

_config.yml如下所示:

# # # # # # # # # # # # #
#   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:      your-id@your-email.com

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]

要在任何基本降价帖子中执行此操作,您自然会做

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

但由于此链接位于网站设置中,因此无效。我搜索了很多,并尝试了5或6个不同的建议但无济于事。

有什么想法吗?会非常感激!!!!

2 个答案:

答案 0 :(得分:2)

这是我在尝试找出相同问题时发现的最高 Google 搜索结果之一。 我找到了一个插件,可以自动设置任何外部 url 以在新标签页中打开:

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

答案 1 :(得分:0)

您需要将target="_blank"添加到index.html12,如下所示:

 <a href="{{ nav.url }}" target="_blank">{{ nav.name }}</a>