我是自学成才/对 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 种不同的建议,但无济于事。
有什么想法吗?将不胜感激!!!
我找到了一个插件,可以自动设置任何外部 URL 以在新选项卡中打开:
https://rubygems.org/gems/jekyll-target-blank
将以下内容添加到您网站的 Gemfile
gem 'jekyll-target-blank'
并将以下内容添加到您网站的 _config.yml
plugins: - jekyll-target-blank
您可能还需要运行bundle install
来安装新的 Gem
您需要将target="_blank"
添加到index.html
行12
,如下所示:
<a href="{{ nav.url }}" target="_blank">{{ nav.name }}</a>
{:target="_blank"}
对我有用:
[text](http://url){:target="_blank"}