【问题标题】:Jekyll - link to posts from pagesJekyll - 链接到页面中的帖子
【发布时间】:2015-07-18 03:37:58
【问题描述】:

一个非常基本的问题。

我不知道如何在页面中引用或引用帖子。

如果这是我的帖子

---
layout: post
title:  "Serve Jekyll Websites with servr and knitr"
categories: [jekyll, rstats]
tags: [knitr, servr, httpuv, websocket]
---

The R package [**servr**](https://github.com/yihui/servr) can be used to set up an HTTP server to serve files under a directory. 

我应该如何在我的page 中引用它

---
layout: page
title: About
permalink: /about/
---

You can find out more info in this post 

你能帮帮我吗?

【问题讨论】:

    标签: jekyll


    【解决方案1】:

    您可以通过两种方式做到这一点:

    1. 复制粘贴为您的帖子生成的链接作为指向它的链接。

      [Check Out My Post!](www.example.com/posts/2015-10-1-name-of-post/)

      这绝对有效,但当您决定更改链接样式、拥有另一个永久链接或更改文件名时会中断/失败。

    2. 更智能的方式:Jekyll 内置 post_url

      Jekyll 有一个内置功能,允许您在内部链接或引用您网站上的帖子。 Here is the documentation 为它,但我会解释语法和用法。

      假设您要链接到位于 _posts 文件夹中的文件名为 2015-07-17-jekyll-servr-tutorial.md 的 Jekyll 帖子,则其语法为:

      • {% post_url 2015-07-17-jekyll-servr-tutorial %}
      • {% post_url /tutorials/2015-07-17-jekyll-servr-tutorial %} 如果您的帖子组织在一个名为 tutorials 的子目录中
      • The R Package [servr]({% post_url 2015-07-17-jekyll-servr-tutorial %}) 如果你想制作超链接。

    使用这个液体标签功能时不需要包含文件扩展名。

    Here 是关于如何使用 Jekyll 帖子链接的附加信息和教程,您可能会发现它们也很有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多