Jekyll - link to posts from pages -


a basic question.

i can not find out how refer or cite post in page.

if post

--- layout: post title:  "serve jekyll websites servr , knitr" categories: [jekyll, rstats] tags: [knitr, servr, httpuv, websocket] ---  r package [**servr**](https://github.com/yihui/servr) can used set http server serve files under directory.  

how suppose cite in page

--- layout: page title: permalink: /about/ ---  can find out more info in post  

could me out ?

you can 2 ways:

  1. copy-pasting link generated post link it.

    [check out post!](www.example.com/posts/2015-10-1-name-of-post/)

    this works, break/fail when decide change link style, or have permalink, or when change file names.

  2. the smarter way: jekyll's built in post_url

    jekyll has built in function allows internally link or cite posts on website. here documentation it, explain syntax , usage well.

    assuming want link jekyll post filename of 2015-07-17-jekyll-servr-tutorial.md located in _posts folder, syntax be:

    • {% post_url 2015-07-17-jekyll-servr-tutorial %}
    • {% post_url /tutorials/2015-07-17-jekyll-servr-tutorial %} if have posts organized in subdirectory called tutorials
    • the r package [servr]({% post_url 2015-07-17-jekyll-servr-tutorial %}) if want make hyperlinks.

there no need include file extension name when using liquid tag function.

here additional information , tutorial on how use jekyll post-links might find useful well.


Comments