将呈现的Jekyll页面的源显示为页面上的链接

时间:2013-12-10 11:34:03

标签: jekyll

假设我们在domain.com/rendered-post/处有一个呈现的Jekyll帖子。

帖子的来源位于https://github.com/username/username.github.io/blob/master/_posts/2013-12-10-rendered-post-title.md

是否可以在呈现时自动将源代码页的链接添加到帖子中?

帖子中的最终结果应为<a href='https://github.com/username/username.github.io/blob/master/_posts/2013-12-10-rendered-post-title.md'>View source code of this page</a>

1 个答案:

答案 0 :(得分:0)

我在布局中使用页面变量{{ page.path }}找到了解决方案。

<a href="https://github.com/username/username.github.io/blob/master/{{ page.path }}">View source code of this page</a>

渲染

<a href='https://github.com/username/username.github.io/blob/master/_posts/2013-12-10-rendered-post-title.md'>View source code of this page</a>
相关问题