Skip to content

palletops/hyde

Repository files navigation

Repository · Issues · Release Notes

A pallet project, Hyde builds Jekyll sites. Hyde provides a programmatic API to generate all the documents that are part of a jekyll site.

Dependency Information

:dependencies [[com.palletops/hyde "0.1.0"]]

Motivation

Automate the building of jekyll sites from content generated programmatically (e.g. document APIs).

Usage

A site is defined by two main data structures:

  • jekyll-config contains the gems for the site
  • site-config contains the configuration of the site itself.

For example:

(def jekyll-config
  {:gems
   [{:gem "jekyll" :version "2.0.3"}
    {:gem "rouge" :version "~> 1.3"}
    {:gem "coderay"}]})

(def site-config
  {:template :crate
   :config
   {:name "test site"
    :title "test title"
    :description "this si a long description"
    :collections
    {:api
     {:output true
      :layout "post"}}}})

Here is an example of building a site in /tmp/site:

(defn build-site [root jekyll-config site-config]
  (create-collections-dirs! root site-config)
  (write-gemfile! root jekyll-config)
  (write-config! root site-config)
  (copy-resources! root site-config)
  (write-document! root {:path "_posts/2012-01-01-my-example.md"
                         :content "this is a *test*!"
                         :front-matter
                         {:title "This is the document"
                          :index 1}})
  (write-collection!
   "/tmp/site"
   "api"
   {:index-key :my-index
    :docs [{:path "doc-a.md"
            :front-matter {:title "doc a"}
            :content "this is doc *a*"}
           {:path "doc-b.md"
            :content "this is verbatim *b*"}]}))

Support

On the group, or #pallet on freenode irc.

License

Licensed under EPL

Copyright 2013 Antoni Batchelli