Ecstatic


Ecstatic creates static web pages and blog posts from Hiccup templates and Markdown. Its written in Clojure.

Ecstatic is open source on Github.

Installation

  1. Clone the repo
  2. Generate executable file using lein bin
  3. Place it on your $PATH.
  4. Make it an executable(using chmod a+x /usr/bin/ecstatic)

(or, you can just use it with lein run)

Creating a new site

To begin using Ecstatic, create a new site:

ecstatic --new mysite

This will create a new directory called mysite which will have the files to get you started:

.
├── site
└── src
    ├── code
    ├── config.clj
    ├── pages
    ├── posts
    ├── resources
    ├── snippets
    └── templates
        ├── base.clj
        ├── index.clj
        ├── page.clj
        └── post.clj

Setup and Configuration

Now, edit the config.clj file in your source directory with the following contents:

{:site-name "Samrat Man Singh"
 :site-url "http://samrat.me"
 :site-description "Personal Blog of Samrat Man Singh."
 :site-author "Samrat Man Singh"
 :always-update ["tags.clj"]}

Of course, you'll want to replace them with your site's own info.

Pages and posts

With Ecstatic, you can build either "pages" or blog posts. They're quite similar, the only major difference being that pages don't appear on your RSS feed. Obviously, the pages/ directory will contain all the pages and the posts/ directory will hold all the posts. Posts should have their file name in the format YYYY-MM-DD-post-slug.md which will turn into /blog/YYYY/MM/post-slug.

Metadata

You specify the metadata at the top of the Markdown file:

---
title: Post Title
date: 2013-01-17T10:10
tags: blog, post
---

For both posts and pages, you can specify a template too if you want to override the default settings.

date is optional for pages. (It'll work for posts too but keep it for the sake of sanity)

tags is optional for both posts and pages.

template defaults to "post"(no need for extension).

Templates

Templates can be specified using Hiccup templates. For an example of how these look, see the index template and the page template. Templates can have an optional "parent" template using the with-base-template function.

Site generation

ecstatic --src ~/code/mysite.com/src --output ~/code/mysite.com