Proper rendering of posts by tag and by author in Octopress

Octopress has generation of per tag index. By default it shows only post title. This works okay, until the moment when you will want to customize category_index.html and try to output some excerpt of post content too. You will face the issue that post content renders incorrectly. This is a problem in plugins/category_generator.rb plugin.

The same problem exists in author_generator.rb plugin.

In both of these plugins one can find the code:

index = CategoryIndex.new(self, self.source, category_dir, category)
index.render(self.layouts, site_payload)
index.write(self.dest)
# Record the fact that this page has been added, otherwise Site::cleanup will remove it.
self.pages << indexCode language: PHP (php)

This code is wrong. The Jekyll engine suppose have different phases for page generation, e.g.: reset, read, generate, render, cleanup and write. Each of this phase is run across all the pages. But plugins for Jekyll are supposed to only override generate phase. The rest of the phases should be done by the Jekyll engine itself.

In the code above we see that plugin tries to make generate, render and write, during generation phase, this is wrong. The plugin is supposed to do only generate phase, the rest are done by Jekyll engine.

The bug fix is very simple, just remove or comment out all occurencies of the lines below in categorygenerator.rb and authorgenerator.rb plugins.

index.render(self.layouts, site_payload)
index.write(self.dest)Code language: CSS (css)

This will fix all the rendering issues.