# Plate [![Build Status](https://secure.travis-ci.org/jdtornow/plate.png)](http://travis-ci.org/jdtornow/plate) [![Dependency Status](https://gemnasium.com/jdtornow/plate.png?travis)](https://gemnasium.com/jdtornow/plate) Plate is a simple static site generator and blogging engine. At its core, it takes a folder full of Markdown files and turns it into a static HTML site that you can host anywhere. In addition to basic formatting with Markdown, Plate also supports generating more dynamic files with ERB or HAML, and compiling asset files with CoffeeScript, Sass and and Less. Plate is a command line utility installed as a Ruby Gem. Installation requires Ruby 1.8.7, 1.9.2 or 1.9.3. Current version is **0.7.0** ## Installation gem install plate Or, create a `Gemfile` and add: gem 'plate' ## Creating a new site To generate a new site with plate, run the following command in the directory you want a new site in: platify . ## Building a site To build your entire site, just run plate Add a `--verbose` tag to show some additional output about what is happening behind the scenes. ## Create a new blog post To create a new blog post with the default options, run: plate post "Your Post Name Here" You can also put default post options (such as a category or layout) into the command line: plate post "Your Post Name Here" --category Articles --layout post If you always end up using the same basic options for every new post, you can add these options as defaults in your [config file](https://github.com/jdtornow/plate/blob/master/doc/config.md#new-post-options). ## Directory Structure Plate observes the following folder structure in your site: * config/ - Configuration options (see [config](https://github.com/jdtornow/plate/blob/master/doc/config.md)) * content/ - All site pages and assets * drafts/ - Any drafted blog posts * helpers/ - Helpers used within dynamic templates (see [Helpers](https://github.com/jdtornow/plate/blob/master/doc/helpers.md)) * layouts/ - Global layouts available for use on all content pages and posts. * lib/ - Extend the basic functionality of Plate with plugins in this directory. (see [DSL](https://github.com/jdtornow/plate/blob/master/doc/dsl.md)) * posts/ - All blog post content for the site. * public/ - This will be generated if it does not exist, contains the produced site. Set this as the web server root to your site for development mode. ## Extending Plate Plate is designed to be easily extended. To get started, create a directory named `lib` in the root of your site. Any Ruby files (ending in `.rb`) will be automatically loaded with the [Plate DSL](https://github.com/jdtornow/plate/blob/master/doc/dsl.md). ## Helpers When using dynamic page templates, such as `erb` or `haml`, you can access Ruby helper methods that are baked in to Plate, or add your own. For more information about helpers, see the [helpers doc](https://github.com/jdtornow/plate/blob/master/doc/helpers.md). ## Draft Posts When creating a new post, you can choose to put it in the *drafts* folder, instead of the posts folder, to hide it from display until the post is complete. Once the post is ready for publishing, just add the following line to the meta data section at the top of the post: ``` publish: true ``` On the next site build, your post will automatically be moved to the appropriate spot in the *posts* folder. By default, the `plate post [Title]` command does not use the drafts folder. To enable draft usage by default when a new post is generated, just change the following line in the `config/plate.yml` file to true: ```yml posts: draft: true ``` ## Partials Plate supports basic partial usage within dynamic pages. If your page is using Erb or Haml, you'll have access to partials. Partial files begin with an underscore, but are referenced in the `render` command without the underscore. To display the contents of a partial located in `content/partials/_header.html`, use the following syntax: ```ruby render 'partials/header' ``` Partials also support local variables. To pass custom variables through to the partial view, just include a hash in the `render` call. Note that only dynamic template partials (such as those ending in .erb or .haml) will be able to take advantage of local variables. ```ruby render 'partials/header', :my => 'local', :vars => 'here' ``` ## Full Documentation View the [full documentation on rdoc.info](http://rdoc.info/gems/plate/frames) ## Issues If you have any issues or find bugs running Plate, please [report them on Github](https://github.com/jdtornow/plate/issues). While most functions should be stable, Plate is still in its infancy and certain issues may be present. ## Testing Plate is fully tested using Test Unit, Shoulda and Mocha. To run the test suite, `bundle install` then run: rake test ## License Plate is released under the [MIT license](http://www.opensource.org/licenses/MIT) Contributions and pull-requests are more than welcome.