This was fun, but it is no longer in active development.
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, 1.9.3 or 2.0.0.
gem install plate
Or, create a
Gemfile and add:
To generate a new site with plate, run the following command in the directory you want a new site in:
To build your entire site, just run
--verbose tag to show some additional output about what is happening behind the scenes.
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.
Plate observes the following folder structure in your site:
- config/ - Configuration options (see config)
- content/ - All site pages and assets
- drafts/ - Any drafted blog posts
- helpers/ - Helpers used within dynamic templates (see Helpers)
- 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)
- 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.
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.
When using dynamic page templates, such as
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.
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:
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:
posts: draft: true
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:
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.
render 'partials/header', :my => 'local', :vars => 'here'
View the full documentation on rdoc.info
If you have any issues or find bugs running Plate, please report them on Github. While most functions should be stable, Plate is still in its infancy and certain issues may be present.
Plate is fully tested using Test Unit, Shoulda and Mocha. To run the test suite,
bundle install then run:
Plate is released under the MIT license
Contributions and pull-requests are more than welcome.