clean-blog

A blog site based on Start Bootstrap's clean-blog design. I run my own blog on this template, malcolmsparks.com. The nice thing is that it's very minimal and once you're confident with Clojure you can personalise it however you wish.

Projects generated with this template get the following features 'out of the box'.

  • Markdown-formatted posts in the posts directory (although this location is configurable), formatted using endophile
  • The option to run the website live, or generate the static content - it's up to you! (except the static content generation bit isn't yet finished)
  • A built-in less compiler, giving you the scope to greatly personalise the design
  • As with all other modular projects, a highly productive resettable workflow
  • With a component-based architecture, easy to modify and add/replace functionality without the project turning into a big ball of mud
  • All the benefits of the Clojure language, such as performance, functional programming, pervasive immutable data structures and more

All this in less than 500 lines of code :)

Getting started

The lein command (see below for the actual incantation) will create a directory with the name of your project. cd into this directory and run lein run which will run your blogsite and launch a browser so you can view it.

If you prefer to generate the static content instead, use lein gen.

Add posts

Add posts in the posts directory. These should be Markdown formatted, but can contain additional metadata lines at the top of the file. For example :-

Title: Prefer data over functions
Subtitle: Functional programming is great, but always prefer data!
Date: 2015-01-31
Keywords: clojure
Background: img/redirect.jpg

Refer to examples from my blog sources.

Developing the site

If you want to hack on the Clojure code to add functionality, feel welcome — that's really the whole point! Instead of running lein run you should run lein repl, then type (dev) to compile and (go) to start the components, then make code changes, then hit (reset) which will reload your modified code and restart all the components.

Components are defined in the system.clj file, at the bottom of the src/ directory.

Static resources

Add static resources, such as images, to resources/public.

Less CSS

The Less files are under resources/less — if you change them they will be recompiled to CSS, under target/css on the next (reset).

Incantation

To create a project called foo based on this template, type this in a command line shell :-

lein new modular foo clean-blog

Modules

component

co-dependency

http-listener

modular-bidi-router

logback-logging

clostache-templater

twitter-bootstrap

jquery

less-compiler

clean-blog-resources

clean-blog-website

endophile

Components

modular.bidi/redirect

modular.bidi/router

modular.bidi/web-resources

modular.clostache/templater

modular.http-kit/webserver

modular.less/compiler

Additional libraries

[clj-time "0.9.0"]

[endophile "0.1.2"]

[com.stuartsierra/component "0.2.2"]

[juxt.modular/co-dependency "0.2.0"]

[org.clojure/tools.logging "0.2.6"]

[org.slf4j/jcl-over-slf4j "1.7.2"]

[org.slf4j/jul-to-slf4j "1.7.2"]

[org.slf4j/log4j-over-slf4j "1.7.2"]

[org.webjars/bootstrap "3.3.0"]

[org.webjars/jquery "2.1.0"]

[ch.qos.logback/logback-classic "1.0.7"]

Custom files

posts/explore.md

posts/failure.md

posts/human.md

posts/science.md

resources/less/clean-blog.less

resources/less/mixins.less

resources/less/variables.less

resources/logback.xml

resources/public/img/about-bg.jpg

resources/public/img/home-bg.jpg

resources/public/img/post-bg.jpg

resources/public/img/post-sample-image.jpg

resources/public/js/clean-blog.min.js

resources/templates/about.html.mustache

resources/templates/index.html.mustache

resources/templates/page.html.mustache

resources/templates/post.html.mustache

src/foo/generate.clj

src/foo/pages.clj


Modularity
Copyright © 2015, LTD.