jekyll markdown internal links

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

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

[[link]] 
6条回答
  •  生来不讨喜
    2020-12-07 09:57

    For pages, they decided not to add a page_url tag because you'd have to know the path of the page anyway. So you just have to link to it manually:

    [My page](/path/to/page.html)
    

    Or you can do something big and ugly like this if you want to programatically get the title of the page:

    {% for page in site.pages %}
      {% if page.url == '/path/to/page.html' %}
    [{{ page.title }}]({{ page.url }})
      {% endif %}
    {% endfor %}
    

提交回复
热议问题