Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll post_url -- what am I missing?

I am using Jekyll and Github pages, testing locally using bundle exec jekyll serve. Everything else works fine so far.

My posts are in a /_posts folder off of the root, and are outputted correctly.

I cannot seem to get {% post_url %} working within posts for other internal posts, no matter what I do.

Example / Question

  • In my _posts folder, I have a post with a file name of 2011-04-14-free-million-dollar-idea-package-carriers-b2b-success.markdown
    • This shows up on my site at [root]/2011/04/free-million-dollar-idea-package-carriers-b2b-success/
  • My config specifies permalink: /:year/:month/:title

I have tried the following references within {% post_url %} from another post, to try to link to the post:

  • 2011-04-14-free-million-dollar-idea-package-carriers-b2b-success
    • Based on the file name of the post, which I thought was what I should be referencing
  • /2011/04/free-million-dollar-idea-package-carriers-b2b-success/
    • Based on the URL that the post actually resides on at my web site
  • 2011/04/free-million-dollar-idea-package-carriers-b2b-success/
    • Without the leading slash
  • /2011/04/free-million-dollar-idea-package-carriers-b2b-success
    • Without the trailing slash
  • 2011/04/free-million-dollar-idea-package-carriers-b2b-success
    • Without either slash

Each one yields the error:

Could not parse name of post [reference] in tag 'post_url'

What am I missing?

like image 509
SeanKilleen Avatar asked Nov 02 '14 18:11

SeanKilleen


2 Answers

If your post file name is 2011-04-14-free-million-dollar-idea-package-carriers-b2b-success.md or .markdown the syntax is :

[Link text]({% post_url 2011-04-14-free-million-dollar-idea-package-carriers-b2b-success %})
like image 133
David Jacquel Avatar answered Nov 17 '22 14:11

David Jacquel


Also check that the front-matter date value matches the date in the post's file name.

(Some versions) of jekyll + safe_yaml can't find the post if the date on the file-name doesn't match the date in the front-matter data.

like image 27
groovecoder Avatar answered Nov 17 '22 13:11

groovecoder