我个人使用可以在任何帖子或页面中使用的链接库(包含)。
注意:如果站点不在域的根目录(例如:localhost/ 或 example.com/)并且位于子文件夹中(例如:localhost/subfolder/),我们需要在内部链接前面加上site.baseurl的值
<!--- file : _includes/_links_library.markdown --->
<!--- POSTS --->
[welcome]: {{site.baseurl}}{% post_url 2014-09-09-welcome-to-jekyll %}
<!--- PAGES --->
[index]: {{site.baseurl}}/subfolder/
[file]: {{site.baseurl}}/subfolder/file.html
<!--- EXTERNAL PAGES --->
[jekyll]: http://jekyllrb.com/
<!--- ANDROID API REF --->
{% assign androidRef = "http://developer.android.com/reference/android" %}
[context]: {{ androidRef }}/content/Context.html
然后我们只需要包含我们的库就可以使用这样的链接:
---
front matter
---
Link to [welcome post][welcome]
Link to [index][]
Link to [Jekyll doc][jekyll]
{% include _links_library.markdown %}