jekyll markdown internal links

后端 未结 6 933
[愿得一人]
[愿得一人] 2020-12-07 09:28

Jekyll uses Markdown-formatted links, but how can I link to internal content?

[[link]] 
6条回答
  •  余生分开走
    2020-12-07 10:02

    It is now possible to link to pages other than posts using the link tag. link works for posts, pages, documents in a collection, and files.

    {{ site.baseurl }}{% link _collection/name-of-document.md %}
    {{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %}
    {{ site.baseurl }}{% link news/index.html %}
    {{ site.baseurl }}{% link /assets/files/doc.pdf %}
    

    Remember to include the file extension when using the link tag. To use it to create a link:

    [Link to a document]({{ site.baseurl }}{% link _collection/name-of-document.md %})
    [Link to a post]({{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %})
    [Link to a page]({{ site.baseurl }}{% link news/index.html %})
    [Link to a file]({{ site.baseurl }}{% link /assets/files/doc.pdf %})
    

    See Jekyll Documentation.

提交回复
热议问题