on master help sign in
Update website a bit
commitefab53729d95cc69a8205bb691db9c12e9e06096 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateMon 13 Jun 2011, 18:26 (15 years ago) parentea69466
16 files changed+171−150
web/about.markdown+4−4 web/css/default.css+14−12 web/examples.markdown+2−2 web/hakyll.hs+17−5 web/index.markdown+8−8 web/philosophy.markdown+4−4 web/reference.markdown+1−1 web/sidebar.markdown+2−2 web/templates/default.html+1−1 web/templates/tutorial-item.html+1 web/templates/tutorial.html+13−3 web/templates/tutorialitem.html−3 web/templates/tutorials.html+2−2 web/tutorials/01-installation.markdown+36 web/tutorial.markdown → web/tutorials/02-basics.markdown+13−103 web/tutorials/faq.markdown+53
web/about.markdown+4−4
@@ -2,13 +2,13 @@
22title: About
33---
44
5−## Code
5+# Code
66
77The code for Hakyll is freely available on
88[github](http://github.com/jaspervdj/Hakyll/). Patches and suggestions are
99always very welcome.
1010
11−## Inspiration
11+# Inspiration
1212
1313Hakyll is not the only static site generator out there. It was inspired by the
1414following awesome projects:
@@ -17,13 +17,13 @@ following awesome projects:
1717- [nanoc](http://nanoc.stoneship.org/)
1818- [Jekyll](http://jekyllrb.com/)
1919
20−## License
20+# License
2121
2222Hakyll is available under a BSD license. Note, however, that pandoc is
2323released under a GPL license. Since you'll probably use Hakyll with pandoc,
2424you will have to license your code under a GPL-compatible license.
2525
26−## Authors
26+# Authors
2727
2828Hakyll was originally written by [Jasper Van der Jeugt](http://jaspervdj.be),
2929who still maintains the package. Contributors:
web/css/default.css+14−12
@@ -14,19 +14,15 @@ body {
1414
1515div#header {
1616 height: 32px;
17− padding: 20px 0px 20px 60px;
17+ margin: 20px 0px 20px 60px;
18+ text-transform: uppercase;
19+ font-weight: bold;
20+ font-size: 28px;
1821}
1922
2023div#header img {
2124 display: inline;
22− vertical-align: middle;
23−}
24−
25−div#header h1 {
26− padding-left: 10px;
27− display: inline;
28− text-transform: uppercase;
29− vertical-align: middle;
25+ margin: 0px 0px 0px 0px;
3026}
3127
3228div#main {
@@ -65,13 +61,19 @@ a {
6561 color: black;
6662}
6763
64+h1 {
65+ font-size: 20px;
66+}
67+
6868h2 {
69− font-size: 120%;
70− text-transform: uppercase;
69+ font-size: 18px;
7170}
7271
7372h3 {
74− font-size: 100%;
73+ font-size: 16px;
74+}
75+
76+h1, h2, h3 {
7577 text-transform: uppercase;
7678}
7779
web/examples.markdown+2−2
@@ -2,7 +2,7 @@
22title: Examples
33---
44
5−## Simple examples
5+# Simple examples
66
77A number of simple examples are available in the GitHub repository. They can be
88found [here](https://github.com/jaspervdj/hakyll-examples). The README located
@@ -11,7 +11,7 @@ directory using
1111
1212 git clone git://github.com/jaspervdj/hakyll-examples.git
1313
14−## People using Hakyll
14+# People using Hakyll
1515
1616A lot of sites running Hakyll also publish the source code. This is a very
1717interesting resource to learn from as well. If you're using Hakyll for your
web/hakyll.hs+17−5
@@ -2,6 +2,7 @@
22import Hakyll
33import Control.Monad (forM_)
44import Control.Arrow ((>>>), arr)
5+import Data.Monoid (mempty)
56import Text.Pandoc
67
78main :: IO ()
@@ -23,15 +24,26 @@ main = hakyll $ do
2324 >>> applyTemplateCompiler "templates/default.html"
2425 >>> relativizeUrlsCompiler
2526
26− -- Tutorial
27− match "tutorial.markdown" $ do
27+ -- Tutorials
28+ match "tutorials/*" $ do
2829 route $ setExtension "html"
29− compile $ readPageCompiler
30− >>> pageRenderPandocWith defaultHakyllParserState withToc
30+ compile $ pageCompilerWith defaultHakyllParserState withToc
3131 >>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
32+ >>> applyTemplateCompiler "templates/tutorial.html"
3233 >>> applyTemplateCompiler "templates/default.html"
3334 >>> relativizeUrlsCompiler
3435
36+ -- Tutorial list
37+ match "tutorials.html" $ route idRoute
38+ create "tutorials.html" $ constA mempty
39+ >>> arr (setField "title" "Tutorials")
40+ >>> setFieldPageList chronological
41+ "templates/tutorial-item.html" "tutorials" "tutorials/*"
42+ >>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
43+ >>> applyTemplateCompiler "templates/tutorials.html"
44+ >>> applyTemplateCompiler "templates/default.html"
45+ >>> relativizeUrlsCompiler
46+
3547 -- Sidebar
3648 match "sidebar.markdown" $ compile pageCompiler
3749
@@ -40,7 +52,7 @@ main = hakyll $ do
4052 where
4153 withToc = defaultHakyllWriterOptions
4254 { writerTableOfContents = True
43− , writerTemplate = "<h2>Table of contents</h2>\n$toc$\n$body$"
55+ , writerTemplate = "$toc$\n$body$"
4456 , writerStandalone = True
4557 }
4658
web/index.markdown+8−8
@@ -2,7 +2,7 @@
22title: Home
33---
44
5−## Overview
5+# Overview
66
77Hakyll is a [Haskell](http://haskell.org) library for generating static sites,
88mostly aimed at small-to-medium sites and personal blogs. It is written in a
@@ -12,32 +12,32 @@ configuration.
1212Integration with [pandoc](http://johnmacfarlane.net/pandoc/) gives us markdown
1313and TeX support, including syntax highlighting and other goodies.
1414
15−## The Hakyll System
15+# The Hakyll System
1616
17−### Write your content in whatever format you prefer
17+## Write your content in whatever format you prefer
1818
1919![Write your content](/images/hakyll-system-1.png)
2020
21−### Create compilation rules in a Haskell EDSL
21+## Create compilation rules in a Haskell EDSL
2222
2323![Write your rules](/images/hakyll-system-2.png)
2424
25−### Compile it to HTML and upload it!
25+## Compile it to HTML and upload it!
2626
2727![Compile it](/images/hakyll-system-3.png)
2828
29−## Hakyll 3
29+# Hakyll 3
3030
3131Hakyll 3 has been released, and it can be installed by running
3232`cabal install hakyll`. For a limited time (but as long as is necessary) you can
3333access the old site and documentation [here](/hakyll2).
3434
35−## Getting Started
35+# Getting Started
3636
3737You can get the latest version from hackage using `cabal install hakyll`. Then,
3838you can:
3939
40−- read the [tutorial](/tutorial.html);
40+- read the [tutorials](/tutorials.html);
4141- mail the [google discussion group](http://groups.google.com/group/hakyll);
4242- ask questions on the IRC channel: `#hakyll` on
4343 [freenode](http://freenode.net/).
web/philosophy.markdown+4−4
@@ -2,25 +2,25 @@
22title: Philosophy
33---
44
5−## Small-to-medium sites
5+# Small-to-medium sites
66
77Hakyll was written to be used for small-to-medium sites. You can do some
88advanced things with it, but don't use it to build a big online shop.
99
10−## Hakyll.hs
10+# Hakyll.hs
1111
1212It should be possible to put all configuration in one file, so data and
1313configuration can be strictly separated. In addition, we think this file should
1414never exceed a 100 lines of code.
1515
16−## High-level
16+# High-level
1717
1818Hakyll tries to provide as many high-level functions as possible for common
1919tasks, while the lower-level functions should also be accessible. If you think
2020you're writing something that can be used for many sites, please send a patch,
2121or your `hakyll.hs`, and we will see what we can do.
2222
23−## Well-documented
23+# Well-documented
2424
2525A key to being easy-to-use is documentation. That's why we try to provide as
2626many working examples as possible. If you ever create a site using hakyll,
web/reference.markdown+1−1
@@ -2,7 +2,7 @@
22title: Reference
33---
44
5−## Reference
5+# Reference
66
77We keep a copy of the reference of the latest stable version here. This
88reference is automatically generated by
web/sidebar.markdown+2−2
@@ -1,9 +1,9 @@
1−## Navigation
1+# Navigation
22
33[home](/index.html)
44[philosophy](/philosophy.html)
55[about](/about.html)
6−[tutorial](/tutorial.html)
6+[tutorials](/tutorials.html)
77[examples](/examples.html)
88[reference](/reference.html)
99[changelog](/changelog.html)
web/templates/default.html+1−1
@@ -34,7 +34,7 @@
3434 <div id="main">
3535 <div id="header">
3636 <img src="/images/lambda.png" alt="lambda" />
37− <h1>Hakyll - $title$</h1>
37+ Hakyll - $title$
3838 </div>
3939 <!-- Sidebar. -->
4040 <div id="sidebar">
web/templates/tutorial-item.htmlnew file+1
@@ -0,0 +1 @@
1+<li><a href="$url$">$title$</a></li>
web/templates/tutorial.html+13−3
@@ -1,10 +1,20 @@
1−$body
1+<h1>Tutorial: $title$</h1>
22
3−<h2>Helping out</h2>
3+$body$
4+
5+<h1>Other tutorials</h1>
6+
7+The other tutorials can be found <a href="/tutorials.html">here</a>.
8+
9+<h1>Helping out</h1>
410
511Hakyll is an open source project, and one of the hardest parts is writing
612correct, up-to-date, and understandable documentation. Therefore, the
713authors would really appreciate it if you would
8−<a href="http://groups.google.com/group/hakyll">give some feedback</a> about
14+<a href="http://groups.google.com/group/hakyll">give feedback</a> about
915the tutorials, and especially report errors or difficulties you encountered.
1016Thanks!
17+
18+If you run into any problems, all questions are welcome in the above google
19+group, or you could try the IRC channel, <code>#hakyll</code> on
20+<a href="http://freenode.net/">freenode</a>.
web/templates/tutorialitem.htmldeleted−3
@@ -1,3 +0,0 @@
1−<li>
2− <a href="$url">$title</a> $what.
3−</li>
web/templates/tutorials.html+2−2
@@ -1,9 +1,9 @@
1−<h2>Tutorials about Hakyll</h2>
1+<h1>Tutorials about Hakyll</h1>
22<p>
33 Here is a list of tutorials I've written about Hakyll:
44</p>
55<ul>
6− $body
6+ $tutorials$
77</ul>
88<p>
99 All these tutorials assume you are using the latest stable version of
web/tutorials/01-installation.markdownnew file+36
@@ -0,0 +1,36 @@
1+---
2+title: Installation
3+---
4+
5+Why static websites?
6+--------------------
7+
8+Modern web frameworks make it easy to create huge dynamic websites. Why would
9+anyone still care about a static website?
10+
11+- Static websites are fast, because it's simply files served directly from the
12+ hard disk.
13+- Static websites are secure. Nobody has ever found an SQL injection in static
14+ pages.
15+- Static websites are easy to deploy. Just copy them to your webhost using
16+ (S)FTP/rsync/scp and you are done. They work on all webhosts: no CGI or extra
17+ modules needed for the web server.
18+
19+Why Hakyll?
20+-----------
21+
22+Hakyll is a [Haskell] library meant for creating small-to-medium sized static
23+websites. It is a powerful publishing tool, precisely because of the power of
24+Haskell. By using the awesome [pandoc] library, it is able to create your
25+website from a large variety of input formats.
26+
27+[Haskell]: http://haskell.org/
28+[pandoc]: http://johnmacfarlane.net/pandoc/
29+
30+Features include:
31+
32+- easy templating system;
33+- a simple HTTP server for previewing and compiling your website on the go;
34+- powerful syntax highlighting;
35+- modules for common items such as tags and feeds;
36+- easily extensible.
web/tutorial.markdown → web/tutorials/02-basics.markdownrenamed+13−103
@@ -1,42 +1,8 @@
11---
2−title: Tutorial
2+title: The basics
33---
44
5−Why static websites?
6−--------------------
7−
8−Modern web frameworks make it easy to create huge dynamic websites. Why would
9−anyone still care about a static website?
10−
11−- Static websites are fast, because it's simply files served directly from the
12− hard disk.
13−- Static websites are secure. Nobody has ever found an SQL injection in static
14− pages.
15−- Static websites are easy to deploy. Just copy them to your webhost using
16− (S)FTP/rsync/scp and you are done. They work on all webhosts: no CGI or extra
17− modules needed for the web server.
18−
19−Why Hakyll?
20−-----------
21−
22−Hakyll is a [Haskell] library meant for creating small-to-medium sized static
23−websites. It is a powerful publishing tool, precisely because of the power of
24−Haskell. By using the awesome [pandoc] library, it is able to create your
25−website from a large variety of input formats.
26−
27−[Haskell]: http://haskell.org/
28−[pandoc]: http://johnmacfarlane.net/pandoc/
29−
30−Features include:
31−
32−- easy templating system;
33−- a simple HTTP server for previewing and compiling your website on the go;
34−- powerful syntax highlighting;
35−- modules for common items such as tags and feeds;
36−- easily extensible.
37−
38−Let's get started!
39−------------------
5+## Let's get started!
406
417We're going to discuss a small brochure site to start with. You can find all
428code and files necessary to build this site
@@ -83,7 +49,7 @@ look in the directory you cloned or downloaded.
8349
8450[brochure-hakyll.hs]: http://github.com/jaspervdj/hakyll-examples/blob/master/brochure/hakyll.hs
8551
86−### Images
52+## Images
8753
8854Let's start of with the `images/haskell-logo.png` file, because the processing
8955of this file is very simple: it is simply copied to the output directory. Let's
@@ -122,7 +88,7 @@ content at all, we just copy the file.
12288
12389[copyFileCompiler]: /reference/Hakyll-Core-Writable-CopyFile.html#v:copyFileCompiler
12490
125−### CSS
91+## CSS
12692
12793If we look at how the two CSS files are processed, we see something which looks
12894very familiar:
@@ -154,7 +120,7 @@ We can wonder what Hakyll does with the resulting `String`. Well, it simply
154120writes this to the file specified in the `route`! As you can see, routes and
155121compilers work together to produce your site.
156122
157−### Templates
123+## Templates
158124
159125Next, we can see that the templates are compiled:
160126
@@ -168,12 +134,12 @@ good impression:
168134~~~~~
169135<html>
170136 <head>
171− <title>Hakyll Example - $title$</title>
137+ <title>Hakyll Example - $$title$$</title>
172138 </head>
173139 <body>
174− <h1>$title$</h1>
140+ <h1>$$title$$</h1>
175141
176− $body$
142+ $$body$$
177143 </body>
178144</html>
179145~~~~~
@@ -181,7 +147,7 @@ good impression:
181147A template is a text file to lay our some content. The content it lays out is
182148called a page -- we'll see that in the next section. The syntax for templates is
183149intentionally very simplistic. You can bind some content by referencing the name
184−of the content *field* by using `$field$`, and that's it.
150+of the content *field* by using `$$field$$`, and that's it.
185151
186152You might have noticed how we specify a compiler (`compile`), but we don't set
187153any `route`. Why is this?
@@ -200,7 +166,7 @@ directory! We want to use it to lay out other items -- so we need to load
200166
201167By using the `templates/*` pattern, we compile all templates in one go.
202168
203−### Pages
169+## Pages
204170
205171The code for pages looks suspiciously more complicated:
206172
@@ -267,9 +233,9 @@ How should we process these pages? [pageCompiler] is the default compiler for
267233pages. [pageCompiler] does a few things:
268234
269235- It parses the page into body and metadata
270−- It adds some extra metadata fields such as `$url$` and `$path$` (you shouldn't
271− worry about these for now)
272−- It fill in possible `$key$`'s in it's own body
236+- It adds some extra metadata fields such as `$$url$$` and `$$path$$` (you
237+ shouldn't worry about these for now)
238+- It fill in possible `$$key$$`'s in it's own body
273239- It renders the page using pandoc
274240
275241Which basically means that we end up with a `Page` that has the HTML content we
@@ -324,59 +290,3 @@ at `example.com` and `example.com/subdir` without changing a single line of
324290code.
325291
326292More tutorials are in the works...
327−
328−Various tips and tricks
329−-----------------------
330−
331−### Syntax highlighting
332−
333−Syntax highlighting is enabled by default in Hakyll. However, you also need to
334−enable it in pandoc. If no syntax highlighting shows up, try
335−
336− [jasper@phoenix] cabal install --reinstall -fhighlighting pandoc
337−
338−### When to rebuild
339−
340−If you execute a `./hakyll build`, Hakyll will build your site incrementally.
341−This means it will be very fast, but it will not pick up _all_ changes.
342−
343−- In case you edited `hakyll.hs`, you first want to compile it again.
344−- It is generally recommended to do a `./hakyll rebuild` before you deploy your
345− site.
346−
347−After rebuilding your site, all files will look as "modified" to the filesystem.
348−This means that when you upload your site, it will usually transfer all files --
349−this can generate more traffic than necessary, since it is possible that some
350−files were not actually modified. If you use `rsync`, you can counter this using
351−the `--checksum` option.
352−
353−Problems
354−--------
355−
356−### regex-pcre dependency on Mac OS
357−
358−Hakyll requires [regex-pcre], which might fail to build on Mac OS. To solve
359−this problem, make sure the [pcre] C library is installed (via homebrew or
360−macports). Then install [regex-pcre] using:
361−
362− cabal install --extra-include-dirs=/usr/local/include regex-pcre
363−
364−or
365−
366− cabal install --extra-include-dirs=/opt/local/include regex-pcre
367−
368−...and proceed to install Hakyll the regular way.
369−
370−[regex-pcre]: http://hackage.haskell.org/package/regex-pcre
371−[pcre]: http://www.pcre.org/
372−
373−### "File name does not match module name" on Mac OS
374−
375− Hakyll.hs:1:1:
376− File name does not match module name:
377− Saw: `Main'
378− Expected: `Hakyll'
379−
380−Is an error encountered on Mac OS when `hakyll.hs` is located on a
381−case-insensitive filesystem. A workaround is to rename it to something that
382−isn't the name of the module, for example, `site.hs`.
web/tutorials/faq.markdownnew file+53
@@ -0,0 +1,53 @@
1+---
2+title: FAQ
3+---
4+
5+## Does Hakyll support syntax highlighting?
6+
7+Syntax highlighting is enabled by default in Hakyll. However, you also need to
8+enable it in pandoc. If no syntax highlighting shows up, try
9+
10+ [jasper@phoenix] cabal install --reinstall -fhighlighting pandoc
11+
12+## When should I rebuild and when should I build?
13+
14+If you execute a `./hakyll build`, Hakyll will build your site incrementally.
15+This means it will be very fast, but it will not pick up _all_ changes.
16+
17+- In case you edited `hakyll.hs`, you first want to compile it again.
18+- It is generally recommended to do a `./hakyll rebuild` before you deploy your
19+ site.
20+
21+After rebuilding your site, all files will look as "modified" to the filesystem.
22+This means that when you upload your site, it will usually transfer all files --
23+this can generate more traffic than necessary, since it is possible that some
24+files were not actually modified. If you use `rsync`, you can counter this using
25+the `--checksum` option.
26+
27+## Problem with regex-pcre dependency on Mac OS
28+
29+Hakyll requires [regex-pcre], which might fail to build on Mac OS. To solve
30+this problem, make sure the [pcre] C library is installed (via homebrew or
31+macports). Then install [regex-pcre] using:
32+
33+ cabal install --extra-include-dirs=/usr/local/include regex-pcre
34+
35+or
36+
37+ cabal install --extra-include-dirs=/opt/local/include regex-pcre
38+
39+...and proceed to install Hakyll the regular way.
40+
41+[regex-pcre]: http://hackage.haskell.org/package/regex-pcre
42+[pcre]: http://www.pcre.org/
43+
44+## "File name does not match module name" on Mac OS
45+
46+ Hakyll.hs:1:1:
47+ File name does not match module name:
48+ Saw: `Main'
49+ Expected: `Hakyll'
50+
51+Is an error encountered on Mac OS when `hakyll.hs` is located on a
52+case-insensitive filesystem. A workaround is to rename it to something that
53+isn't the name of the module, for example, `site.hs`.