post.content markdown not rendered
I'm displaying full posts in my archives but the post is displaying the raw markdown and not being rendered.
Using {{ content }} also doesn't show the content at all.
Ah, I see. Generators are called before the render process is complete. That said, this should work nevertheless. Can you post a link to your site? What does your archive template look like? What version of Jekyll are you using?
I haven't got the site live yet as there's still a lot of other things I need to first.
Here's the archive layout I'm using with the Jekyll 2.5.2.
---
layout: default
---
<h2 class="archive-title">Archives: {{ page.title | date: '%B %Y' }}</h2>
{% for post in page.posts %}
<article>
<header class="entry-header">
<h2 class="entry-title">
<a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</h2>
<time class="published" datetime="{{ post.date }}" pubdate="">
<a href="{{ post.url | prepend: site.baseurl }}">{{ post.date | date_to_string }}</a>
</time>
</header>
<div class="entry-content">
{{ content }}
</div>
</article>
{% endfor %}
Using {{ content }} instead of {{ page.content }} doesn't return anything.
Yeah it has to be post.content instead of content or page.content.
and we're back to my original statement. When I use post.content, none of the markdown or liquid tags are rendered.
and we're back to my original statement. When I use post.content, none of the markdown or liquid tags are rendered.
What does that mean? Plain text? Or a code block? Can you paste a screenshot?
Here's the screenshot.

Is this not the case for any post/page listing? post.content contains the raw input, not the processed output.
Here's the snippet for my index.html file that displays everything correctly.
<div class="listing">
{% for post in paginator.posts %}
<article>
<header class="entry-header">
<h2 class="entry-title">
<a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</h2>
<time class="published" datetime="{{ post.date }}" pubdate="">
<a href="{{ post.url | prepend: site.baseurl }}">{{ post.date | date: '%B %d, %Y' }}</a>
</time>
</header>
<div class="entry-content">
{{ post.content }}
</div>
</article>
{% endfor %}
</div>
I'm running into this bug too -- {{post.content}} in an archive page loop does not process through markdown -- so you end up getting the raw markdown text instead of intended HTML.
I'm running into this bug too -- {{post.content}} in an archive page loop does not process through markdown -- so you end up getting the raw markdown text instead of intended HTML.
Generators are run before the render step. https://github.com/jekyll/jekyll/blob/master/lib/jekyll/site.rb#L51-L58
Understood, thanks!
I'm wondering where the solution lies. It feels like the current behavior is undesirable. Is this something that needs to be filed against Jekyll itself -- an improvement for Generators for future consideration? Or is there a way to improve jekyll-archives here? Thanks.
The solution is to allow Jekyll to do the rendering itself. The jekyll-paginate process does this by appending a Page to site.pages and letting Jekyll do its thing. From a cursory glance at the source code here, the render process is taken care of here, which would yield this error. /cc @alfredxing
@parkr Nice catch! I'll see about fixing that up and just adding it as a Page.
I’m not sure if I’m misunderstanding the status of this issue, but is there a workaround for this currently, or does the jekyll-archives plugin need to be fixed?
@matthewmcvickar Sorry for the wait; I've been quite busy recently with school. I'll get around to this as soon as I have some time!
Just looked into this again, and now I remember why I didn't append the archives to site.pages: if this was done, anyone iterating over site.pages (in the nav, for example) would see archive pages as well...
@parkr Any suggestions?
The only way to enforce this would be to render every item...
You mean render every page as necessary?
The markdownify filter might be useful for this.
{{post.content | markdownify}} or {{ content | markdownify}}, whatever fits.
While using markdownify does appear to render the markdown, it doesn't render {% highlight bash %}
I had this same issue. I have an _include file for all my posts. For the archive layout, I just did the following:
{% for post in page.posts %}
{% include post.html item=post markdown=true %}
{% endfor %}
and within my post include:
{% if include.markdown %}
{{ include.item.content | markdownify }}
{% else %}
{{ include.item.content }}
{% endif %}
Since generators are run before renders, this might be the only solution (unless you do the markdown step in the generation in jekyll-archives itself... haven't looked at the code to see how possible that is)
While the previous suggestion of an include works for markdown, it still doesn't render {% highlight bash %} blocks.
Is there a similar method like markdownify that does render code highlights? hilightify?
{{post.content | markdownify | hilightify }}
Not to my knowledge. I've been able to get rid of the problem by downgrading from jekyll-3.0.0.pre.beta8 to jekyll-2.5.3 for the time being... (though that means going back to dealing with issue #2607 which was fixed in the beta :disappointed_relieved:).
This still happens with jekyll-2.5.3 and jekyll-archives 2.0.0. @MaximeKjaer, what is your setup where you can get post.content rendered from a jekyll-archives layout?
I have been getting the same issue as this. It was strange because some of the .content was coming through after the markdown had been applied... and then stopped on a few others...
My solution was
{% for post in site.categories.solutions reversed %}
{{ post.content | markdownify }}
{% endfor %}
Getting the same issue with this when using {{post.excerpt}}
{{post.exceprt | markdownify}} works, but doesn't render highlight blocks {% highlight ruby %}
is there any fix for this?
@nbolten I'm having some real trouble replicating this. It happened without jekyll-archive (I somehow overlooked that this was a jekyll/jekyll-archives, and not jekyll/jekyll issue page, so I don't know if my initial comment still is relevant -- sorry!).
I'll try to look into it some more, and will post if I find anything of interest.
This problem also happens with collections. I guess this means you should really provide a way to render the content of an element like markdownify (which by the way doesn't render tables and such things provided by redcarpet if you specify it in _config.yml).
Thanks!
EDIT: Maybe this is a different issue though. Collections documents supposedly have an output property which does exactly what we want, but for me, it does nothing.
http://jekyllrb.com/docs/collections/#documents
I am having the same problem running on Debian Jessie using the following gems.
bigdecimal (1.2.6) bundler-unload (1.0.2) executable-hooks (1.3.2) gem-wrappers (1.2.7) io-console (0.4.3) json (1.8.1) minitest (5.4.3) power_assert (0.2.2) psych (2.0.8) rake (10.4.2) rdoc (4.2.0) rubygems-bundler (1.4.4) rvm (1.11.3.9) test-unit (3.0.8)
I believe I'm running Jekyll version 3, but I don't know how to get the current version of Jekyll that I'm using.
The solution that worked for me was: {{ page.content | markdownify }}
I was using Kramdown for my markdown.