Andry
Andry

Reputation: 16895

Cannot reference a post with proper base address in Jekyll

I am trying to reference a post in my github pages site http://myuser.github.io/myproj/ with Jekyll:

{% post_url 2016-03-21-mypost %}

This will point to http://myuser.github.io/post/2016/03/21/mypost.html which is wrong, as it should point to: http://myuser.github.io/myproj/post/2016/03/21/mypost.html. Thus I tried:

{% (post_url 2016-03-21-mypost) | prepend: site.baseurl %}

Where site.baseurl is /myproj. But it fails:

Liquid Exception: Liquid syntax error (line 26): Tag '{% (post_url 2016-03-21-mypost) | prepend: site.baseurl %}' was not properly terminated with regexp: /\%}/ in /home/myuser/Git/myproj/_posts/2016-03-21-mypost.md

How can I reference my post with the base address?

Upvotes: 2

Views: 154

Answers (1)

David Jacquel
David Jacquel

Reputation: 52829

You can't add a filter to a tag {% %} except for the assign tag {% assign myvar = 'toto' | capitalize %}.

Try : {{ site.baseurl }}{% post_url 2016-03-21-mypost %}

Upvotes: 1

Related Questions