html - {{ content }} Liquid tag not showing blog posts -
link repo: https://github.com/alvsovereign/alvsovereign.github.io
i coding portfolio site, link blog. processed portfolio site sits in _site/index.html contains link blog (fully processed link exists in _site/blog.html)
blog.html @ root of repo has in front matter layout of "bl", defined in layouts folder under "bl.html".
"bl.html" layout want blog page, contains includes etc. contains {{ content }} liquid tag.
if thinking right way, posts being parsed (i think right terminology) "post.html" - has front matter "layout: bl", parsed "bl.html", , both have {{ content }} in each files.
now posts showing correctly (i think) within _site/(year)/(month) etc. however, not ending being parsed through "blog.html" file, , visible on webpage. how know processed "blog.html" file not have of posts in them.
what need solve issue?
if helps, use prepros livereload, , using lanyon template, http://lanyon.getpoole.com/
{{ content }} refers content in file being converted html code.
for example, if passing blog post on 'what jekyll' layout has {{ content }} tag, text other yaml front matter put in place. content of post. can limit scope using {{ post.content }}, see variables more info here.
so liquid {{ content }} variable works intended.
looking @ website, believe you're trying display posts in blog.html file, you're asking why aren't posts being displayed (not parsed) in blog.html file, hence not visible on webpage.
the reason because shouldn't use {{ content }} tag that, want instead snippet of code as mentioned in jekyll docs, grab posts, , display them post title, link post. here's code display list of posts. (taken website linked you)
<ul> {% post in site.posts %} <li> <a href="{{ post.url }}">{{ post.title }}</a> </li> {% endfor %} </ul> so swap out {{ content }} in bl.html layout code snippet , you've got want.
additionally, if also want display content/excerpt in list of posts, add liquid tag {{ post.content }} or {{post.excerpt}} so:
<ul> {% post in site.posts %} <li> <a href="{{ post.url }}">{{ post.title }}</a> {{ post.content }} /* or post.excerpt */ </li> {% endfor %} </ul> of course, edit html accordingly preference. read documentation on how set post excerpts here, uses <!--more--> comment separator excerpts.
i recommend reading jekyllrb documentation more information, it's lot read , not understandable, keep referring , you'll understand more in no time.
Comments
Post a Comment