【问题标题】:What is the syntax to create a pdf link in _config.yml在 _config.yml 中创建 pdf 链接的语法是什么
【发布时间】:2019-06-22 02:24:32
【问题描述】:

我正在使用 Jekyll 创建个人网站。我正在使用非常流行的Beautiful-Jekyll template_config.yml 中已经定义了一个导航栏。我想将简历链接到我的简历 pdf。

我已经用这段代码(_config.yml)完成了:

# List of links in the navigation bar
navbar-links:
  Moi: "aboutme"
  Projects:
    - Hell Game: "http://deanattali.com/beautiful-jekyll/"
    - Success City: "http://www.markdowntutorial.com/"
  Resume: "Tech Resume.pdf"

但是,这只会在同一选项卡中打开简历。我希望它在单独的选项卡中打开。在 HTML 中,您可以使用 target="_blank" 来实现这一点。如何在 YAML 中执行此操作?

我尝试了this,但我的index.html 实际上并没有使用链接。我知道,很奇怪。

【问题讨论】:

  • 链接的模板肯定是does use links的导航栏项目,它只是在一个包含的文件中,而不是直接在index.html中。

标签: yaml jekyll


【解决方案1】:

beautiful-jekyll/_includes/nav.html 第 26 行:

<a href="{{ linkparts[1] | relative_url }}">{{ linkparts[0] }}</a>

改成:

<a href="{{ linkparts[1] | relative_url }}" 
{% if linkparts[1] contains '.pdf' %}target="_blank"{% endif %}
>{{ linkparts[0] }}</a>

或者使用这个 (java) 脚本/解决方案: https://jekyllcodex.org/without-plugin/new-window-fix/

【讨论】:

    猜你喜欢
    • 2016-05-20
    • 1970-01-01
    • 2011-02-20
    • 2012-09-12
    • 2017-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多