Jekyll - link 从页面发帖

Jekyll - link to posts from pages

一个非常基本的问题。

我找不到如何在页面中引用或引用 post。

如果这是我的 post

---
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 

你能帮帮我吗?

您可以通过两种方式执行此操作:

  1. 将为您的 post 生成的 link 作为 link 复制粘贴到它。

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

    这确实有效,但是 break/fail 当您决定更改 link 样式,或使用另一个 permalink,或更改文件名时。

  2. 更聪明的方式:Jekyll 内置于post_url

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

    假设你想 link 到文件名为 2015-07-17-jekyll-servr-tutorial.md 的 Jekyll post,它位于 _posts 文件夹中,语法为:

    • {% post_url 2015-07-17-jekyll-servr-tutorial %}
    • {% post_url /tutorials/2015-07-17-jekyll-servr-tutorial %} 如果您将 post 组织在名为 tutorials
    • 的子目录中
    • The R Package [servr]({% post_url 2015-07-17-jekyll-servr-tutorial %}) 如果你想制作 hyperlinks.

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

Here 是有关如何使用 Jekyll post-link 的附加信息和教程,您可能会发现它们也很有用。