Cryogen

screenshot of Cryogen

A simple static site generator written in Clojure

Overview

This product analysis is for Cryogen, a static site generator. Cryogen allows users to create blog posts and pages using Markdown or AsciiDoc, generate table of contents, use plain HTML page templates, and integrate code syntax highlighting, Disqus support, Sitemap generation, RSS feed generation, Sass/SCSS compilation, and Klipse integration.

Features

  • Blog posts and pages with Markdown or AsciiDoc: Users can create blog posts and pages using either Markdown or AsciiDoc.
  • Tags: Cryogen supports adding tags to organize and categorize content.
  • Table of contents generation: Cryogen can automatically generate a table of contents for pages.
  • Plain HTML page templates: Users can create their own plain HTML page templates.
  • Code syntax highlighting: Code snippets in blog posts and pages can be highlighted for better readability.
  • Disqus support: Cryogen supports integrating with Disqus for commenting functionality on blog posts.
  • Sitemap generation: Cryogen can generate a sitemap for search engine optimization.
  • RSS feed generation: Users can generate an RSS feed to allow readers to subscribe to their blog.
  • Sass/SCSS compilation: Cryogen can compile Sass/SCSS files for easier styling.
  • Klipse Integration: Cryogen supports integrating with Klipse for interactive code execution within blog posts.

Creating a New Site With Leiningen

  1. Make sure you have Leiningen 2.5.0 or above installed.
  2. Run the following command to create a new site using the Cryogen Leiningen template:
lein new cryogen <site-name>

Creating a New Site With clj-new as a Tool

  1. Use the following command to create a new site with clj-new as a tool:
clj -Sdeps '{:deps {seancorfield/clj-new {:mvn/version "1.1.280"}}}' -X clj-new/create :template cryogen :name <site-name>

Creating a New Site With deps-new as a Tool

  1. Use the following command to create a new site with clj-new as a tool:
clojure -Sdeps '{:deps {oakes/duct {:mvn/version "0.10.0"}
                       cryogen/lein-template {:mvn/version "0.2.5"}}}' -m duct.main create my-blog :template cryogen/lein-template

Running the Server

To start the web server, navigate to the my-blog directory (replace with your site directory) and run the following commands:

Using Leiningen:

lein ring server

Using tools-deps:

clojure -A:dev

The server will watch for changes in the content and themes folders and recompile the content automatically. The *:fast variants perform fast but partial compilation of only the changed page/post.

You can also generate the content without bringing up a server either via:

lein run once

or via:

clojure -A:once

Site Configuration

The site configuration file is found at content/config.edn. This file contains key-value pairs for configuring the Cryogen site. For more information about each key, refer to the "Configuration" portion of the Cryogen documentation site.

Switching between Markdown and AsciiDoc

By default, Cryogen supports Markdown. If you want to use AsciiDoc instead, open the project.clj file in your created blog directory (e.g. my-blog) and change the line in :dependencies that says cryogen-flexmark to cryogen-asciidoc (and ensure the right version). Instead of looking for files ending in .md in the content/md directory, the compiler will now look for files ending in .asc in the content/asc directory.

Selecting a Theme

The Cryogen template comes with three themes in the themes folder. To change your blog's theme, open config.edn and change the value of the :theme key. Note that the Nucleus theme is obtained from downloadwebsitetemplates.co.uk, which requires you to keep the footer unless you make a donation on their website.

Customizing Layouts

Cryogen uses the Selmer templating engine for layouts. Refer to the Selmer documentation to see the supported tags and filters for layouts. The layouts are contained in the themes/{theme}/html folder of the project. By default, the base.html layout is used to provide the general layout for the site. This is where you would add static resources such as CSS and JavaScript assets as well as define headers and footers for your site. Each page layout should have a name that matches the :layout key in the page metadata and end with .html. Page layouts extend the base layout and should only contain the content relevant to the page inside the content block.

Summary

Cryogen is a static site generator with a range of features. It allows users to create blog posts and pages using Markdown or AsciiDoc, generate table of contents, use plain HTML page templates, and integrate code syntax highlighting, Disqus support, Sitemap generation, RSS feed generation, Sass/SCSS compilation, and Klipse integration. The installation process involves creating a new site using Leiningen, clj-new, or deps-new and configuring the site using the config.edn file. Users can customize the layouts using the Selmer templating engine. Overall, Cryogen offers a versatile solution for generating statically-rendered websites with a focus on blogging.