Cryogen

Static sites generated with Clojure

Your Options

Cryogen provides some flexible configuration options. Your site's configuration file can be found at templates/config.edn and contains the following by default:

{:site-title           "My Awesome Blog"
 :author               "Bob Bobbert"
 :description          "This blog is awesome"
 :site-url             "http://blogawesome.com/"
 :post-root            "posts"
 :page-root            "pages"
 :post-root-uri        "posts-output"
 :page-root-uri        "pages-output"
 :tag-root-uri         "tags-output"
 :author-root-uri      "authors-output"
 :blog-prefix          "/blog"
 :rss-name             "feed.xml"
 :rss-filters          ["cryogen"]
 :recent-posts         3
 :post-date-format     "yyyy-MM-dd"
 :archive-group-format "yyyy MMMM"
 :sass-src             []
 :sass-path            "sass"
 :compass-path         "compass"
 :theme                "blue"
 :resources            ["img"]
 :keep-files           [".git"]
 :disqus?              false
 :disqus-shortname     ""
 :ignored-files        [#"\.#.*" #".*\.swp$"]
 :previews?            false
 :posts-per-page       5
 :blocks-per-preview   2
 :clean-urls?          true
 :hide-future-posts?   true
 :klipse               {}
 :debug?               false}

Details

Keys marked with a * must be provided.

Key Description
* site-title Your site's title
* author Your name goes here!
* description A blurb describing your site
* site-url Your site's root url. This, along with all of the above values are used when generating your sitemap and RSS feed.
* post-root The folder where the compiler will look for blog posts.
* page-root The folder where the compiler will look for your custom pages.
post-root-uri The folder where the compiler will output compiled blog posts. This value is prepended to all post uri's. If this key is omitted then the name of the output folder will be the same as the post-root folder. If the an string ("") is provided then the posts will be outputted to the root folder of the blog (ie. resources/public/{blog-prefix}).
page-root-uri The folder where the compiler will output compiled pages. This value is prepended to all page uri's. If this key is omitted then the name of the output folder will be the same as the page-root folder. If the empty string ("") is provided then the posts will be outputted to the root folder of the blog.
tag-root-uri The folder where the compiler will output compiled tag pages. This value is prepended to all tag page uri's. If this key is omitted then the empty string will be used.
author-root-uri If this value is provided then the compiler will generate a page for each author containing a list of all their posts. More info here.
* blog-prefix Prepended to all uri's. This must start with a slash.
* rss-name The name of the rss file generated.
* rss-filters A vector of specific tags for which you want to create a separate RSS feed.
* recent-posts The maximum number of recent posts to show in the sidebar.
* post-date-format Set the date format that you want to use for the names of your .md files representing your posts.
archive-group-format Set the date format in which your archive page is organised. "yyyy" organises by year, "yyyy MMMM" organises by year and month; nil defaults to "yyyy MMMM".
sass-src A vector of directories containing sass(scss) files to be compiled. If this key is omitted then the default is ["css"]. Be sure to include these directories in your resources section as the compiled css will be outputted in the same directory.
sass-path Path at which the sass executable can be found. The default value "sass" works if you have the executable in your path, in that case nothing needs to be changed. If the executable is not in the search path or has a different name than please adapt this value.
compass-path Path at which the compass executable can be found. Just as with the sass-path fhe default value "compass" works if you have the executable in your path, in that case nothing needs to be changed. If the executable is not in the search path or has a different name than please adapt this value.
* theme Set this to the theme you wish to deliver from the themes directory. You can add your own theme to this folder along with the current blue, blue_centered and nucleus themes.
* resources A vector of directories/files to be copied over from templates to public upon compilation.
* keep-files A vector of directories/files to preserve when wiping the public folder between compilations.
* disqus? Set this to true if you want Disqus enabled on your site. disqus-shortname must be provided if this is true.
disqus-shortname Your Disqus shortname.
* ignored-files A vector of regexes matching files that you want to ignore during compilation. (Ex: emacs interlock files.)
* previews? Set this to true if you would like to display a list of recent posts rather than a full, single post on your home page. Discussed here. post-per-page and blocks-per-preview must provided if this is true.
post-per-page If post previews are enabled then this is the maximum number of previews on a page.
blocks-per-preview The default number of (html) blocks to display per post preview. This can be overwritten by adding <!–more–> to your .md or .asc file to indicate where you'd like to break off your post.
* clean-urls? Set this to true to emit html as subdirectories, e.g., prefix/root/page-name/index.html instead of prefix/root/page-name.html. Links would then end in /page-name/ instead of /page-name.html.
* hide-future-posts? Set this to true to include only current and past blogs in the compiled site. This allows for easy drafting of future articles.
klipse Set Klipse configuration for the whole site. See Klipse Integration for details.
* debug? Enable debug outputs for compiler.

In addition to these default configuration options, you may add your own custom values. For example, if your blog has a subtitle that you'd like to display on your site:

  1. Add :subtitle "My subtitle" to the config file
  2. Inject the value into your templates via Selmer using {% subtitle %}

Advanced Configuration

If you want to override or extend config.edn from code, (e.g. by reading environment variables or by using an untracked file) you can edit src/cryogen/core.clj and src/cryogen/server.clj to pass a clojure map to the compile-assets-timed function. This is especially useful if you are making use of the custom values to configure 3rd party integrations like ReCaptcha.

For Example, if you wanted to have private options loaded from a secrets.edn file, you could do the following:

 ;; src/cryogen/core.clj

 ;; ...
 (defn -main []
   (let [overrides (read-string (slurp "secrets.edn"))]
     (load-plugins)
     (compile-assets-timed overrides)
     (System/exit 0)))
 ;; ...
 

 ;; src/cryogen/server.clj

 ;; ...
 (defn init []
  (load-plugins)
  (compile-assets-timed (read-string (slurp "secrets.edn")))
  (let [ignored-files (-> (read-config) :ignored-files)]
    (start-watcher! "resources/templates" ignored-files (partial compile-assets-timed
                                                                 (read-string (slurp "secrets.edn"))))))
;; ...