7

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

是我正在使用的网站主题。我希望在选项卡中打开最后一个“github”链接,而不是在当前选项卡中打开的默认链接。

_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 种不同的建议,但无济于事。

有任何想法吗?将不胜感激!!!!

4

2 回答 2

4

您需要添加 target="_blank"index.html以下行12

 <a href="{{ nav.url }}" target="_blank">{{ nav.name }}</a>
于 2017-07-10T10:23:43.807 回答
4

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

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

于 2021-01-27T01:53:13.967 回答