on master help sign in
Work on installation tutorial
commita2620eec367711480ee2e34ada39b76dc52dbb17 authorJasper Van der Jeugt <m@jaspervdj.be> dateFri 14 Dec 2012, 10:42 (14 years ago) parentcfac1bb
5 files changed+42−45
.gitignore+1−1 web/index.markdown+3 web/hakyll.hs → web/site.hs+7−7 web/templates/tutorials.html+3−3 web/tutorials/01-installation.markdown+28−34
.gitignore+1−1
@@ -18,5 +18,5 @@ _site
1818# Rest of the file: ignore examples
1919web/_cache
2020web/_site
21−web/hakyll
21+web/site
2222web/reference
web/index.markdown+3
@@ -4,6 +4,9 @@ title: Home
44
55# Overview
66
7+Static sites are fast, secure, easy to deploy, and manageable using version
8+control.
9+
710Hakyll is a [Haskell](http://haskell.org) library for generating static sites,
811mostly aimed at small-to-medium sites and personal blogs. It is written in a
912very configurable way and uses an [xmonad](http://xmonad.org)-like DSL for
web/hakyll.hs → web/site.hsrenamed+7−7
@@ -22,23 +22,23 @@ main = hakyllWith config $ do
2222 match "*.markdown" $ do
2323 route $ setExtension "html"
2424 compile $ pageCompiler
25− >>= requireApplyTemplate "templates/default.html" defaultContext
25+ >>= loadAndApplyTemplate "templates/default.html" defaultContext
2626 >>= relativizeUrls
2727
2828 -- Tutorials
2929 match "tutorials/*" $ do
3030 route $ setExtension "html"
3131 compile $ pageCompilerWith defaultHakyllParserState withToc
32− >>= requireApplyTemplate "templates/tutorial.html" defaultContext
33− >>= requireApplyTemplate "templates/default.html" defaultContext
32+ >>= loadAndApplyTemplate "templates/tutorial.html" defaultContext
33+ >>= loadAndApplyTemplate "templates/default.html" defaultContext
3434 >>= relativizeUrls
3535
3636 -- Tutorial list
3737 match "tutorials.html" $ do
3838 route idRoute
3939 compile $ do
40− tutorials <- requireAll "tutorials/*"
41− itemTpl <- requireBody "templates/tutorial-item.html"
40+ tutorials <- loadAll "tutorials/*"
41+ itemTpl <- loadBody "templates/tutorial-item.html"
4242 list <- applyTemplateList itemTpl defaultContext $
4343 chronological tutorials
4444
@@ -48,8 +48,8 @@ main = hakyllWith config $ do
4848 defaultContext
4949
5050 makeItem ""
51− >>= requireApplyTemplate "templates/tutorials.html" tutorialsCtx
52− >>= requireApplyTemplate "templates/default.html" tutorialsCtx
51+ >>= loadAndApplyTemplate "templates/tutorials.html" tutorialsCtx
52+ >>= loadAndApplyTemplate "templates/default.html" tutorialsCtx
5353 >>= relativizeUrls
5454
5555 -- Templates
web/templates/tutorials.html+3−3
@@ -8,7 +8,7 @@
88<p>
99 All these tutorials assume you are using the latest stable version of
1010 Hakyll. If this is not the case, you might want to update using:
11− <pre><code>ghc-pkg unregister hakyll
12−cabal update
13−cabal install hakyll</code></pre>
11+ <pre><code>$ ghc-pkg unregister hakyll
12+$ cabal update
13+$ cabal install hakyll</code></pre>
1414</p>
web/tutorials/01-installation.markdown+28−34
@@ -3,46 +3,13 @@ title: Installation
33author: Jasper Van der Jeugt
44---
55
6−Why static websites?
7−--------------------
8−
9−Modern web frameworks make it easy to create huge dynamic websites. Why would
10−anyone still care about a static website?
11−
12−- Static websites are fast, because it's simply files served directly from the
13− hard disk.
14−- Static websites are secure. Nobody has ever found an SQL injection in static
15− pages.
16−- Static websites are easy to deploy. Just copy them to your webhost using
17− (S)FTP/rsync/scp and you are done. They work on all webhosts: no CGI or extra
18− modules needed for the web server.
19−
20−Why Hakyll?
21−-----------
22−
23−Hakyll is a [Haskell] library meant for creating small-to-medium sized static
24−websites. It is a powerful publishing tool, precisely because of the power of
25−Haskell. By using the awesome [pandoc] library, it is able to create your
26−website from a large variety of input formats.
27−
28−[Haskell]: http://haskell.org/
29−[pandoc]: http://johnmacfarlane.net/pandoc/
30−
31−Features include:
32−
33−- easy templating system;
34−- a simple HTTP server for previewing and compiling your website on the go;
35−- powerful syntax highlighting;
36−- modules for common items such as tags and feeds;
37−- easily extensible.
38−
396Installation
407------------
418
429Installation is provided using [cabal], and some packages are available for
4310different distributions.
4411
45− cabal install hakyll
12+ $ cabal install hakyll
4613
4714[cabal]: http://www.haskell.org/cabal/
4815
@@ -50,3 +17,30 @@ Linux distro packages:
5017
5118- [Archlinux (AUR)](https://aur.archlinux.org/packages/haskell-hakyll/)
5219- [Debian unstable](http://packages.debian.org/source/sid/haskell-hakyll)
20+
21+Building the example site
22+-------------------------
23+
24+Apart from the main Hakyll library, the cabal package also provided you with an
25+executable `hakyll-init` to create an example site. This is an easy way to get
26+started:
27+
28+ $ hakyll-init my-site
29+
30+If `hakyll-init` is not found, you should make sure `$HOME/.cabal/bin` is in
31+your `$PATH`.
32+
33+The file `site.hs` holds the configuration of your site, as an executable
34+haskell program. We can compile and run it like this:
35+
36+ $ cd my-site
37+ $ ghc --make site.hs
38+ $ ./site build
39+
40+If you installed `hakyll` with a preview server (this is the default), you can
41+now use
42+
43+ $ ./site preview
44+
45+and have a look at your site at
46+[http://localhost:8000/](http://localhost:8000/).