ruby - Using {{ content }} and generators in Jekyll index pages -


in jekyll, post displayed in layout thusly:

{{ content }} 

any generators might have run on content displayed so:

{{ content | toc_generate }} 

unfortunately, not work on index pages, {{ content }} displays nothing on index pages. instead, told use loop:

{% post in site.posts %}     {{ post.content }} {% endfor %} 

so, question:

how can generator run on index page, since can't use {{ content }}?

my best guess...

{% post in site.posts %}     {{ post | toc_generator }} {% endfor %} 

...does nothing.

any help?

try :

{% capture content %}     {% post in site.posts %}         <h2>{{ post.tile }}</h2>         {{ post.content }}     {% endfor %} {% endcapture %} {{ content | toc_generator }} {{ content }} 

Popular posts from this blog