Skip to content

Commit 43f043c

Browse files
author
Dan Sutton
committed
Intial cryogen commit
0 parents  commit 43f043c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2397
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pom.xml
2+
pom.xml.asc
3+
*jar
4+
/lib/
5+
/classes/
6+
/target/
7+
/checkouts/
8+
.lein-deps-sum
9+
.lein-repl-history
10+
.lein-plugins/
11+
.lein-failures
12+
/resources/public/

project.clj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(defproject cryogen "0.1.0"
2+
:description "Simple static site generator"
3+
:url "https://github.com/lacarmen/cryogen"
4+
:license {:name "Eclipse Public License"
5+
:url "http://www.eclipse.org/legal/epl-v10.html"}
6+
:dependencies [[org.clojure/clojure "1.8.0"]
7+
[ring/ring-devel "1.5.1"]
8+
[compojure "1.5.2"]
9+
[ring-server "0.4.0"]
10+
[cryogen-markdown "0.1.6"]
11+
[cryogen-core "0.1.55"]]
12+
:plugins [[lein-ring "0.9.7"]]
13+
:main cryogen.core
14+
:ring {:init cryogen.server/init
15+
:handler cryogen.server/handler})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{:title "Adoc Page"
2+
:layout :page
3+
:page-index 0
4+
:navbar? true}
5+
6+
== Adoc Page ==
7+
8+
We support http://asciidoc.org/[asciidoc] too!
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{:title "Adoc Post"
2+
:layout :post
3+
:tags ["cryogen" "asciidoc"]
4+
:toc false
5+
}
6+
7+
:toc: macro
8+
9+
== Example Asciidoc Post ==
10+
This is an example asciidoc post.
11+
12+
You can use a manually placed table of contents by setting `:toc false` in the front matter, but use `:toc: macro` at the top of the post, and `toc::[]` where the table of contents is supposed to be, like here:
13+
14+
toc::[]
15+
16+
=== Section 1 ===
17+
18+
.Heading
19+
20+
With some text and maybe even a bulleted list:
21+
22+
- Thing 1
23+
- Thing 2
24+
25+
Or how about some *bold* or _italicized_ text?
26+
27+
=== Section 2 ===
28+
29+
Will a code snippet work?
30+
31+
.bash
32+
[source,bash]
33+
----
34+
$ echo "foo"
35+
----
36+
37+
.clojure
38+
[source,clojure]
39+
----
40+
(defn echo [s]
41+
(println s))
42+
----
43+
44+

resources/templates/config.edn

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{:site-title "My Awesome Blog"
2+
:author "Bob Bobbert"
3+
:description "This blog is awesome"
4+
:site-url "http://blogawesome.com/"
5+
:post-root "posts"
6+
:page-root "pages"
7+
:post-root-uri "posts-output"
8+
:page-root-uri "pages-output"
9+
:tag-root-uri "tags-output"
10+
:author-root-uri "authors-output"
11+
:blog-prefix "/blog"
12+
:rss-name "feed.xml"
13+
:rss-filters ["cryogen"]
14+
:recent-posts 3
15+
:post-date-format "yyyy-MM-dd"
16+
:archive-group-format "yyyy MMMM"
17+
:sass-src []
18+
:sass-path "sass"
19+
:compass-path "compass"
20+
:theme "blue"
21+
:resources ["img"]
22+
:keep-files [".git"]
23+
:disqus? false
24+
:disqus-shortname ""
25+
:ignored-files [#"\.#.*" #".*\.swp$"]
26+
:posts-per-page 5
27+
:blocks-per-preview 2
28+
:previews? false
29+
:clean-urls? true
30+
:hide-future-posts? true
31+
:klipse {}
32+
:debug? false}

resources/templates/css/example.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a {
2+
text-decoration-style: dashed;
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
body {
2+
a {
3+
text-decoration-style: dashed;
4+
}
5+
}

resources/templates/img/cryogen.png

37.1 KB
Loading

resources/templates/md/pages/about.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{:title "About"
2+
:layout :page
3+
:page-index 0
4+
:navbar? true}
5+
6+
## Write something about something
7+
8+
wow wow wow
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{:title "Another Page"
2+
:layout :page
3+
:page-index 1}
4+
5+
## Look at this sweet page
6+
7+
this is another custom page
8+
totally not a post
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{:title "A Post"
2+
:layout :post
3+
:tags ["not fetch"]}
4+
5+
### This Post Not Fetch Enough
6+
7+
some stuff happened
8+
9+
>and a quote appeared
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{:title "Yet Another Post"
2+
:layout :post
3+
:tags ["very fetch"]}
4+
5+
### This Post So Fetch
6+
7+
some more stuff happened
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
{:title "Quick Start Guide"
2+
:layout :post
3+
:tags ["cryogen"]
4+
:toc true}
5+
6+
This intro only documents a subset of Cryogen's features. For additional documentation please see the [cryogen site](http://cryogenweb.org).
7+
8+
## Features
9+
10+
* Blog posts and pages with Markdown (default) or AsciiDoc
11+
* Tags
12+
* Table of contents generation
13+
* Plain HTML page templates
14+
* Code syntax highlighting
15+
* Disqus support
16+
* Sitemap generation
17+
* RSS feed generation
18+
* Sass/SCSS compilation
19+
* Klipse Integration
20+
21+
## Prerequisites
22+
23+
You will need [Leiningen][1] 2.5.0 or above installed.
24+
25+
[1]: https://github.com/technomancy/leiningen
26+
27+
## Usage
28+
29+
### Creating a New Site
30+
31+
A new site can be created using the Cryogen template as follows:
32+
33+
```
34+
lein new cryogen my-blog
35+
```
36+
37+
### Running the Server
38+
39+
The web server can be started from the `my-blog` directory using the `lein-ring` plugin:
40+
41+
```
42+
lein ring server
43+
```
44+
45+
The server will watch for changes in the `resources/templates` folder and recompile the content automatically.
46+
47+
### Site Configuration
48+
49+
The site configuration file is found at `templates/config.edn`, this file looks as follows:
50+
51+
```clojure
52+
{:site-title "My Awesome Blog"
53+
:author "Bob Bobbert"
54+
:description "This blog is awesome"
55+
:site-url "http://blogawesome.com/"
56+
:post-root "posts"
57+
:page-root "pages"
58+
:post-root-uri "posts-output"
59+
:page-root-uri "pages-output"
60+
:tag-root-uri "tags-output"
61+
:author-root-uri "authors-output"
62+
:blog-prefix "/blog"
63+
:rss-name "feed.xml"
64+
:rss-filters ["cryogen"]
65+
:recent-posts 3
66+
:post-date-format "yyyy-MM-dd"
67+
:archive-group-format "yyyy MMMM"
68+
:sass-src []
69+
:sass-path "sass"
70+
:compass-path "compass"
71+
:theme "blue"
72+
:resources ["img"]
73+
:keep-files [".git"]
74+
:disqus? false
75+
:disqus-shortname ""
76+
:ignored-files [#"\.#.*" #".*\.swp$"]
77+
:posts-per-page 5
78+
:blocks-per-preview 2
79+
:previews? false
80+
:clean-urls? true
81+
:hide-future-posts? true
82+
:klipse {}
83+
:debug? false}
84+
```
85+
86+
For information about each key please see the ["Configuration"](http://cryogenweb.org/docs/configuration.html) portion of the Cryogen documentation site.
87+
88+
### Switching between Markdown and AsciiDoc
89+
90+
Cryogen comes with Markdown support as default. If you want to use AsciiDoc instead, open the `project.clj` in your created blog (e.g. `my-blog`), and change the line in `:dependencies` that says `cryogen-markdown` to `cryogen-asciidoc`.
91+
Instead of looking for files ending in `.md` in the `resources/templates/md` directory, the compiler will now look for files ending in `.asc` in the `resources/templates/asc` directory.
92+
93+
### Selecting a Theme
94+
95+
The Cryogen template comes with two themes in the `resources/templates/themes` folder. To change your blog's theme, change the value of the `:theme` key in `config.edn`.
96+
97+
### Customizing Layouts
98+
99+
Cryogen uses [Selmer](https://github.com/yogthos/Selmer) templating engine for layouts. Please refer to its documentation
100+
to see the supported tags and filters for the layouts.
101+
102+
The layouts are contained in the `resources/templates/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
103+
assets as well as define headers and footers for your site.
104+
105+
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.
106+
For example, the `tag` layout is located in `tag.html` and looks as follows:
107+
108+
```xml
109+
{% extends "templates/html/layouts/base.html" %}
110+
{% block content %}
111+
<div id="posts-by-tag">
112+
<h2>Posts tagged {{name}}</h2>
113+
<ul>
114+
{% for post in posts %}
115+
<li>
116+
<a href="{{post.uri}}">{{post.title}}</a>
117+
</li>
118+
{% endfor %}
119+
</ul>
120+
</div>
121+
{% endblock %}
122+
```
123+
124+
### Code Syntax Highlighting
125+
126+
Cryogen uses [Highlight.js](https://highlightjs.org/) for code syntax highlighting. You can add more languages by replacing `templates/js/highlight.pack.js` with a customized package from [here](https://highlightjs.org/download/).
127+
128+
The ` initHighlightingOnLoad` function is called in `{theme}/html/base.html`.
129+
130+
```xml
131+
<script>hljs.initHighlightingOnLoad();</script>
132+
```
133+
134+
## Deploying Your Site
135+
136+
The generated static content will be found under the `resources/public` folder. Simply copy the content to a static
137+
folder for a server such as Nginx or Apache and your site is now ready for service.
138+
139+
A sample Nginx configuration that's placed in `/etc/nginx/sites-available/default` can be seen below:
140+
141+
```javascript
142+
server {
143+
listen 80 default_server;
144+
listen [::]:80 default_server ipv6only=on;
145+
server_name localhost <yoursite.com> <www.yoursite.com>;
146+
147+
access_log /var/log/blog_access.log;
148+
error_log /var/log/blog_error.log;
149+
150+
location / {
151+
alias /var/blog/;
152+
error_page 404 = /404.html;
153+
}
154+
}
155+
```
156+
157+
Simply set `yoursite.com` to the domain of your site in the above configuration and
158+
ensure the static content is available at `/var/blog/`. Finally, place your custom error page
159+
in the `/var/blog/404.html` file.
160+
161+
More information on deployment can be found [here](http://cryogenweb.org/docs/deploying-to-github-pages.html).
162+
163+
## Some Sites Made With Cryogen
164+
165+
* [Creator's blog](http://carmenla.me/blog/index.html)
166+
* [Cryogen Documentation Site](http://cryogenweb.org)
167+
* [Yogthos' blog](http://yogthos.net/)
168+
* [Clojure :in Tunisia](http://www.clojure.tn)
169+
* [dl1ely.github.io](http://dl1ely.github.io)
170+
* [nil/recur](http://jonase.github.io/nil-recur)
171+
* [on the clojure move](http://tangrammer.github.io/)
172+
* [cognizance](http://blog.jethrokuan.com/)
173+
* [AGYNAMIX Site & Blog](http://www.agynamix.de)
174+
* [e-Resident Me](http://eresident.me)
175+
* [Chad Stovern's blog](http://www.chadstovern.com)
176+
* [Greative](https://greative.jp/)

0 commit comments

Comments
 (0)