document available template variables #11

dherman opened this Issue May 19, 2012 · 1 comment

2 participants


I've been poking around at the default templates and using introspection like #{Object.keys(file)} to find out what built-in template variables are available for the layout files, but it'd be great to get a list of these in the README. So far I see:


Any others? I'm happy to file a pull request with a patch to the README.



Sorry about the lack of documentation. Yes, there are a few other things that you should know about.

For the file section.

  • title, template, render-file can be over-written from the header of the markdown file being parsed using yaml.
  • render-file indicates whether an *.html file should be saved for the markdown file being parsed.
  • weight is also a valid yaml variable that impacts the order that file will show up in its files group.
  • Any other variable you put in the header of the markdown file will also be available.

For the files groups.

  • The groups are mostly arbitrary. The only one that is consistent is the root. If you were to delete the posts folder from your data path, the posts group would disappear from files. If you were to add a folder called api to your data path, that would add a group called api to your files template variable set.
  • The template that is default for a group is the group name .jade in the templates folder. With our previous example, you would need an api.jade in your template path.

There is also a site global template variable which holds everything from the locals section of the codex.json file. Useful for things like site titles, analytics keys, etc.

A few projects you will want to check out. In addition to the skeleton that comes with codex, I have also put out codex-hub. It demonstrates some of the more advanced concepts as well as the javascript documentation parser plugin.

Also, the website is mostly based codex. You can check out the repo here.

Let me know if you have more questions or if any of this need clarification. Also feel free to put any of this or other things you learn into the readme :)

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