A simple static site generator written in Clojure
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.
lein new cryogen <site-name>
clj -Sdeps '{:deps {seancorfield/clj-new {:mvn/version "1.1.280"}}}' -X clj-new/create :template cryogen :name <site-name>
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
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
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.
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.
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.
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.
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.