category generator: No 'category_index' layout found #116

masukomi opened this Issue Aug 24, 2011 · 14 comments


None yet
6 participants

masukomi commented Aug 24, 2011

clone a new copy of the octopress repo, cd into it, then do the following.

Note that the error will go away after some mucking about (not sure what exactly) but it is definitely reproducible if you start with a fresh repo as below:

~/workspace/temp/octopress master $ rake new_page[foo.markdown]
Creating new page: source/foo.markdown
~/workspace/temp/octopress master ☢ $ rake new_post['foo foo foo']
Creating new post: source/_posts/2011-08-24-foo-foo-foo.markdown
~/workspace/temp/octopress master ☢ $ rake generate
## Generating Site with Jekyll
Configuration from /Users/masukomi/workspace/temp/octopress/_config.yml
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Building site: source -> public
/Users/masukomi/workspace/temp/octopress/plugins/category_generator.rb:76:in `throw': uncaught throw "No 'category_index' layout found." (ArgumentError)
    from /Users/masukomi/workspace/temp/octopress/plugins/category_generator.rb:76:in `write_category_indexes'
    from /Users/masukomi/workspace/temp/octopress/plugins/category_generator.rb:89:in `generate'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/jekyll-0.11.0/lib/jekyll/site.rb:184:in `block in generate'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/jekyll-0.11.0/lib/jekyll/site.rb:183:in `each'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/jekyll-0.11.0/lib/jekyll/site.rb:183:in `generate'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/jekyll-0.11.0/lib/jekyll/site.rb:39:in `process'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/jekyll-0.11.0/bin/jekyll:250:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/bin/jekyll:19:in `load'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/bin/jekyll:19:in `<main>'

imathis commented Aug 24, 2011

Hmmm, I'll give it a shot. Thanks.


imathis commented Aug 24, 2011

Did you forget to run rake install? If you don't install the octopress theme you don't have a Jekyll project to generate.


masukomi commented Aug 24, 2011

ahh. yes, i did, although though some means I don't recall I did manage to get it past that without running rake install.

Maybe the bug is that the user is presented with a stack trace when they should be presented with a human readable error ... "foo happened. Did you forget to run rake install first?"

The fix may be a test somewhere in the rake task before it even gets to rendering things.

I think it's important that all the simple errors that can be easily made by a new user be addressed in a fashion that doesn't require reading source code. The thinking being that if the new blog platform can't even get the first test post rendered without throwing a stack trace at the user, how can it be expected to do their day to day functions without issue.


imathis commented Aug 24, 2011

The setup instructions clearly say to rake install. I think it would be a nice enhancement to try to warn users who haven't installed the theme, but for people following the setup instructions, this isn't a problem.


masukomi commented Aug 24, 2011

I can't disagree... but when was the last time you met a geek who thoroughly read all the instructions before starting to use some new piece of software?


imathis commented Aug 24, 2011

Yeah, I know what you mean. It would be nice, but I'm not sure about the priority of this issue.

masukomi added a commit to masukomi/octopress that referenced this issue Aug 25, 2011

Rakefile now checks for source and _layouts dirs before generating
Previously the generate task would call jekyll even if you were
missing the source and / or source/_layouts directory.

Now it will check for the existence of both and prompt the user
to take the appropriate action.

This commit fixes #116

@imathis imathis closed this in b38b613 Aug 25, 2011


masukomi commented Aug 26, 2011

Testing for the source dir is insufficient. You can run rake new_post["foo"] which will create a source dir but still lack the _layouts dir. Running generate after that will cause this error to occur.


imathis commented Aug 26, 2011

I'm trying to understand under what conditions someone would have the source directory and not the _layout directory. Can you describe a reasonable use case where this is warranted, or are we just trying to help people who've been monkeying around? Why not be even more specific and check for the source/_layout/category_index.HTML?


masukomi commented Aug 26, 2011

use case
user likes what they see on
user checks out repo.
user skims instructions to find out how to make a post (because geeks rarely ever read instructions thoroughly)
runs new_post
wants to see said post so finds place in instructions where it tells how to generate / render things
runs generate

It's exactly what I did and doesn't seem unreasonable to expect that others will do the same.

The fix is so simple it doesn't seem like something to avoid doing.

As for being more specific and looking for category_index.html right now it's just as valid an option. I was trying to be a little more generic and allow for the possibility that category_index.html may change down the road, but there are arguments against my generic approach too. Maybe it's best to go with category_index.html now and handle the issue of that file name changing when / if it ever does. Looking just for _layout has the potentially faulty assumption that if someone has a _layout directory it contains all the required files, but as there's no documentation of what files are and are not required it seems a bad assumption to make.


masukomi commented Aug 26, 2011

on further thought... while i think the check should be there in generate... maybe there should also be a check in new_post / new_page maybe the tasks should all say "hey I'm not gonna do jack until you get off your but and run install, because that should have been the first thing you did"

jeje added a commit to jeje/octopress that referenced this issue Aug 27, 2011

Merge branch 'master' of git://
* 'master' of git:// (21 commits)
  removed rsync deploy config from Rakefile. Oops
  sitemap_generator dies if public dir doesn't exist yet
  Somehow I replaced Rakefile with oder version, oops
  Added warning if users try to add posts, pages, or generate their site before installing an Octopress theme, fixes #116
  removed unnecessary mkdir_p in update_style, fixed #67
  sleeps wait, cleaned up rake preview and rake watch a bit
  Do not rely on system specifc syntax for preview or watch.
  Removes system specific File IO from Rakefile, rather we make use of FileUtils.
  Makes update_source and update_style much more windows friendly.
  updated date now shows up properly
  updated Gemfile.lock, fixes #59
  using @extend for responsive blocks, added shadow-box mixin to utlities for configurable border shadow box styling, moved .left, .right, .center classes to .basic-alignment class for @extending as needed in layouts. Fixes #109
  added support for deploying "dot" files (eg. .htaccess), fixes #104
  include_code now defaults to relative urls for easy testing on a development server
  improved lang:language for codeblock and include code. It no longer strips out surrounding whitespace.
  added option to force syntax highlighting language, example: {% include_code file lang:ruby %}. Fixes #108
  centralized pygments aliases into pygments_code.rb. Added alias for .ru (ruby), which sort of fixes #108
  added excerpt_link to article include. fixes #97
  now only excerpted articles show the "read on" link. Also the text for that link can be set in the _config.yml
  added stringex gem for permalink url generation

I have the same problem... Whenever I try... rake generate... An exception is raised...
...plugins/category_generator.rb:114:in `throw': uncaught throw "No 'category_index' layout found." (ArgumentError)

I don't know but, appears that it's just happened when my deploy is github-pages...

switz commented Nov 20, 2011

I'm getting the same error as klebervirgillo except I'm using Heroku.

I already ran rake install, but when I tried running it again I got this error:

No such file or directory - .themes/classic/source/.

EDIT: I fixed the issue.

Download the Octopress source.

Move the .themes folder to your Blog directory.

Run rake install and type y when it tells you a theme is already installed.

Run rake generate and everything should run smoothly (at least it did for me!).

I'm not sure what broke the first time around, but my .themes folder was gone even though rake install ran fine. Copied it back in and everything was smooth sailing from there on out.

masukomi pushed a commit to masukomi/octopress that referenced this issue Dec 8, 2011


richo commented Jan 11, 2013

I followed the setup instructions, ran into deploy troubles (thought that github would do the jekyll render but it looks like I need to do it and push the resultant files).

As a result I had to back out and I wound up running into this. Emitting a user readable error would have saved a lot of source shovelling.

HungMingWu added a commit to HungMingWu/octopress that referenced this issue Jan 17, 2013

antifuchs added a commit to antifuchs/octopress that referenced this issue Jan 20, 2013

Merge branch 'master' of into bo…

* 'master' of (29 commits)
  improved regexes for setup_github_pages task
  Removed unnecessary passive group from octopress origin regex
  setup_github_pages: allow for clones missing .git extension
  Video tag plugin now supports mp4,ogv,webm formats, closes #931
  Striped whitespace from titles in blockquote plugin
  Fixed blockquote plugin (author alone would not show up without title)
  Improved error message for category_generator plugin. Addresses #116
  updated ender.js to latest
  Escape github repo descriptions, as they may contain HTML.
  removed accidentally added file
  Rake task new_post now accepts titles through stdin This should help resolve issues for zsh users and make it easier to enter titles which freak out Rake's argument processing
  updated gems
  Removed unnecessary regex in code block plugin
  Titles in code plugins can have slashes in them. Closes #892
  gist tag plugin now works with the latest changes GitHub gists and does not fail if you do not specify a filename.
  Rakefile option for any additional rsync arguments
  Fixing English error pet-peeve.
  To support url without domain name like /path/file
  Disabled Rsync delete by default. Closes #787


briansimmons pushed a commit to briansimmons/octopress that referenced this issue Aug 20, 2013

Still getting this issue.

I ran through all the setup instructions, including running rake install on a fresh install.

The new theme installed successfully:

$ rake install['oscailte']
A theme is already installed, proceeding will overwrite existing files. Are you sure? [y/n] y
## Copying oscailte theme into ./source and ./sass
mkdir -p source
cp -r .themes/oscailte/source/. source
mkdir -p sass
cp -r .themes/oscailte/sass/. sass
mkdir -p source/_posts
mkdir -p public/github

Then when I went to do rake generate, I got this message:

$ rake generate
## Generating Site with Jekyll
overwrite source/stylesheets/screen.css 
Configuration from /myproject/octopress/_config.yml
Building site: ./blog -> public/github
 /myproject/octopress/plugins/category_generator.rb:116:in `write_category_indexes':  (RuntimeError)

 Error for category_generator.rb plugin
 No 'category_index.html' in source/_layouts/
 Perhaps you haven't installed a theme yet.

    from  /myproject/octopress/plugins/category_generator.rb:139:in `generate'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/gems/jekyll-0.12.0/lib/jekyll/site.rb:190:in `block in generate'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `each'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `generate'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/gems/jekyll-0.12.0/lib/jekyll/site.rb:40:in `process'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/bin/jekyll:23:in `load'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/bin/jekyll:23:in `<main>'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
    from /Users/me/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'

I thought it maybe was an issue with ruby 1.9.3 at first, so I switched to 2.0.0 and it's the same issue.

Also, please note that I do have this category_index.html file in my _source/_layouts

$ ls
category_index.html default.html        page.html       post.html
$ pwd

Also, this is the content of my category_index.html file:

layout: page
footer: false

<div id="blog-archives" class="category">
{% for post in site.categories[page.category] %}
{% capture this_year %}{{ | date: "%Y" }}{% endcapture %}
{% unless year == this_year %}
  {% assign year = this_year %}
  <h2>{{ year }}</h2>
{% endunless %}
  {% include archive_post.html %}
{% endfor %}

What could be causing this and how do I fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment