• Stars
    star
    193
  • Rank 194,615 (Top 4 %)
  • Language
    Clojure
  • License
    BSD 2-Clause "Sim...
  • Created over 13 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Static Site Generator

Static is a simple static site generator written in Clojure. For a sample site build using static see nakkaya.com

Features

Static can parse org-mode and markdown files.

Dependencies

Static requires the leiningen build tool. Once installed, you can build Static with the following commands from within the project directory structure:

$ lein deps
$ lein uberjar

Usage

Creating a static site usually involves the following,

  • Set up the basic structure of the site
  • Create some posts
  • Run your site locally to see how it looks
  • Deploy your site

A basic static site usually looks something like this:

.
|-- config.clj
`-- resources
   |-- posts
   |   |-- 2009-04-17-back-up-and-restore-a-mysql-database.markdown
   |   |-- 2010-02-10-a-simple-clojure-irc-client.markdown
   |   `-- 2010-08-02-using-clojure-contrib-generic-interfaces.markdown
   |-- public
   |   `-- 404.html
   |-- site
   |   `-- index.markdown
   `-- templates
       `-- default.clj

An overview of what each of these does:

config.clj

Contains a vector of configuration options.

  • :site-title - Title of the site.
  • :site-description - Description of the site.
  • :site-url - URL of the site.
  • :author-name - Name of the author.
  • :author-email - E-mail address of the author.
  • :copyright-year - Year the pages were created/copyrighted.
  • :in-dir - Directory containing site content by default resources/
  • :out-dir - Directory to save compiled files.
  • :atomic-build - When set, will build the site on a temporary directory first then move that directory to :out-dir.
  • :default-template - Default template to use.
  • :encoding - Encoding to use for read write operations.
  • :posts-per-page - Number of posts in latest post pages.
  • :blog-as-index - If true use blog as index.
  • :emacs - path to emacs if you want to render .org files.
  • :emacs-eval - elisp code to be evaluated on the emacs process.
  • :host - remote host to deploy to.
  • :user - remote username
  • :deploy-dir - Remote directory to deploy to.
  • :rsync - path to rsync if you want to deploy with rsync.

The variables can later be reused (for example in your default template) as:

(:author-name (static.config/config))

posts/

Folder containing posts, the format of these files are important, as named as YEAR-MONTH-DATE-title.MARKDOWN.

public/

Folder containing static data such as images, css, javascript etc. Folder structure will be mirrored exactly.

site/

Folder containing pages that are not posts.

templates/

Folder containing templates that are used to render posts and pages with.

Markup

Supported markup languages,

  • markdown
  • org-mode (via emacs)
  • clojure (hiccup)
  • cssgen
  • html

Setting per page/post settings

Setting the template, title etc, for a page/post is done using a header placed at the top of the file,

org-mode

#+title: Blogging Like a Hacker
#+tags: clojure

Markdown

---
template: temp-en.clj
title: Blogging Like a Hacker
---

Clojure

{:title "Blogging Like a Hacker"}

cssgen

cssgen does not support file-specific settings.

Page/Post Settings

  • template - If set, this specifies the template file to use. Use the layout file name with file extension. Layout files must be placed in the templates directory.
  • title - Override the use of default title.
  • alias - Generates redirect pages for posts with aliases set. ([β€œ/first-alias/index.html”, β€œ/second-alias/index.html”]) Place the full path of the alias (place to redirect from) inside the destination post.

Any other setting you provide can be accessed from within your template.

Installation

You need to place the uberjar lein created to the folder containing config.clj.

Building the site

java -jar static-app.jar --build

Testing the site

You can test the site locally using jetty, which will launch on http://localhost:8080. The site will rebuild if you change any of the source files.

java -jar static-app.jar --watch

In order to run just jetty,

java -jar static-app.jar --jetty

Deploying the site

RSYNC

$ java -jar static-app.jar --rsync

Code

You can grab the latest version from the repo.

For bug reports/fixes/help, see contact.

Any feature requests are also welcome see contact.

License

Copyright (C) 2010 - 2017

BSD 2-Clause License

Copyright (c) 2017, Nurullah Akkaya All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS β€œAS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

More Repositories

1

ferret

Ferret is a free software lisp implementation for real time embedded control systems.
Makefile
1,063
star
2

clodiuno

Clojure API for the firmata protocol.
Clojure
139
star
3

vision

OpenCV wrapper for Clojure
C
132
star
4

alter-ego

A reactive AI library based on the concept of behavior trees.
Clojure
48
star
5

nakkaya.com

nakkaya.com
Clojure
43
star
6

net-eval

Dead Simple Distributed Computing for Clojure
Clojure
35
star
7

emacs

Emacs init files
Dockerfile
21
star
8

vector-2d

Collection of 2D Vector Operations.
16
star
9

emacsd

Dockerfile
14
star
10

inbox-feed

inbox-feed is a tool for delivering news from RSS feeds to your email program.
Clojure
10
star
11

makeWay

Isolate hosts from network.
C++
9
star
12

mocha

ARPWatch / Log Watcher for Mac OS X and Linux
Java
9
star
13

ferret-logging

C++
4
star
14

ferret-opencv

Clojure
4
star
15

ardrone

Ar Drone API for Clojure
Clojure
4
star
16

rest-sql

Rest SQL serves a fully RESTful API from a PostgreSQL database.
Makefile
3
star
17

war-logs

Clojure
3
star
18

ferret-genann

C
3
star
19

inf-ipy

A REPL interface to communicate with Jupyter kernels in Emacs or CLI.
Python
3
star
20

ferret-mosquitto

C++
3
star
21

appengine-stub

appengine-stub
Clojure
3
star
22

easy-dns

easyDNS Client
Clojure
3
star
23

ferret-boost

Clojure
2
star
24

ferret-websocket

C++
2
star
25

corba

arduino line follower
C++
2
star
26

travis-test

JavaScript
1
star
27

jnibwapi

Checkout of jnibwapi
Java
1
star
28

ferret-L6470-AutoDriver

Ferret Bindings for Sparkfun BabyDriver stepper board. SPI driven 3A 8-45V, based on L6470 part from Linear
C++
1
star
29

ferret-teensy-flight-sim

Clojure
1
star
30

ferret-great-circle-navigation

Clojure
1
star
31

solarcar-turn-indicator

Clojure
1
star
32

ferret-arduino-keypad

Clojure
1
star
33

control-toolbox

Clojure
1
star