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

E48*_*89D 7 jekyll jekyll-extensions github-pages jekyll-bootstrap jekyll-paginator

我是自学的/完全不熟悉 Jekyll 和 Github Pages,想知道如何在 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]
Run Code Online (Sandbox Code Playgroud)

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

[a link](http://example.com){:target="_blank"}
Run Code Online (Sandbox Code Playgroud)

但由于此链接位于站点设置中,因此不起作用。我已经搜索了很多并尝试了 5 或 6 种不同的建议,但都无济于事。

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

iam*_*eef 9

我发现一个插件可以自动设置任何外部 URL 以在新选项卡中打开:

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

将以下内容添加到您网站的 Gemfile

gem 'jekyll-target-blank'
Run Code Online (Sandbox Code Playgroud)

并将以下内容添加到您站点的 _config.yml

plugins:
  - jekyll-target-blank
Run Code Online (Sandbox Code Playgroud)

您可能还需要运行bundle install来安装新的 Gem


小智 5

您需要添加 target="_blank"index.html12如下:

 <a href="{{ nav.url }}" target="_blank">{{ nav.name }}</a>
Run Code Online (Sandbox Code Playgroud)