diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | web/index.markdown | 3 | ||||
-rw-r--r-- | web/site.hs (renamed from web/hakyll.hs) | 14 | ||||
-rw-r--r-- | web/templates/tutorials.html | 6 | ||||
-rw-r--r-- | web/tutorials/01-installation.markdown | 62 |
5 files changed, 42 insertions, 45 deletions
@@ -18,5 +18,5 @@ _site # Rest of the file: ignore examples web/_cache web/_site -web/hakyll +web/site web/reference diff --git a/web/index.markdown b/web/index.markdown index 68681b7..06c2780 100644 --- a/web/index.markdown +++ b/web/index.markdown @@ -4,6 +4,9 @@ title: Home # Overview +Static sites are fast, secure, easy to deploy, and manageable using version +control. + Hakyll is a [Haskell](http://haskell.org) library for generating static sites, mostly aimed at small-to-medium sites and personal blogs. It is written in a very configurable way and uses an [xmonad](http://xmonad.org)-like DSL for diff --git a/web/hakyll.hs b/web/site.hs index 93a7216..f106ca7 100644 --- a/web/hakyll.hs +++ b/web/site.hs @@ -22,23 +22,23 @@ main = hakyllWith config $ do match "*.markdown" $ do route $ setExtension "html" compile $ pageCompiler - >>= requireApplyTemplate "templates/default.html" defaultContext + >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls -- Tutorials match "tutorials/*" $ do route $ setExtension "html" compile $ pageCompilerWith defaultHakyllParserState withToc - >>= requireApplyTemplate "templates/tutorial.html" defaultContext - >>= requireApplyTemplate "templates/default.html" defaultContext + >>= loadAndApplyTemplate "templates/tutorial.html" defaultContext + >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls -- Tutorial list match "tutorials.html" $ do route idRoute compile $ do - tutorials <- requireAll "tutorials/*" - itemTpl <- requireBody "templates/tutorial-item.html" + tutorials <- loadAll "tutorials/*" + itemTpl <- loadBody "templates/tutorial-item.html" list <- applyTemplateList itemTpl defaultContext $ chronological tutorials @@ -48,8 +48,8 @@ main = hakyllWith config $ do defaultContext makeItem "" - >>= requireApplyTemplate "templates/tutorials.html" tutorialsCtx - >>= requireApplyTemplate "templates/default.html" tutorialsCtx + >>= loadAndApplyTemplate "templates/tutorials.html" tutorialsCtx + >>= loadAndApplyTemplate "templates/default.html" tutorialsCtx >>= relativizeUrls -- Templates diff --git a/web/templates/tutorials.html b/web/templates/tutorials.html index 36d1f03..dd3132b 100644 --- a/web/templates/tutorials.html +++ b/web/templates/tutorials.html @@ -8,7 +8,7 @@ <p> All these tutorials assume you are using the latest stable version of Hakyll. If this is not the case, you might want to update using: - <pre><code>ghc-pkg unregister hakyll -cabal update -cabal install hakyll</code></pre> + <pre><code>$ ghc-pkg unregister hakyll +$ cabal update +$ cabal install hakyll</code></pre> </p> diff --git a/web/tutorials/01-installation.markdown b/web/tutorials/01-installation.markdown index 131971f..a0a0f3a 100644 --- a/web/tutorials/01-installation.markdown +++ b/web/tutorials/01-installation.markdown @@ -3,46 +3,13 @@ title: Installation author: Jasper Van der Jeugt --- -Why static websites? --------------------- - -Modern web frameworks make it easy to create huge dynamic websites. Why would -anyone still care about a static website? - -- Static websites are fast, because it's simply files served directly from the - hard disk. -- Static websites are secure. Nobody has ever found an SQL injection in static - pages. -- Static websites are easy to deploy. Just copy them to your webhost using - (S)FTP/rsync/scp and you are done. They work on all webhosts: no CGI or extra - modules needed for the web server. - -Why Hakyll? ------------ - -Hakyll is a [Haskell] library meant for creating small-to-medium sized static -websites. It is a powerful publishing tool, precisely because of the power of -Haskell. By using the awesome [pandoc] library, it is able to create your -website from a large variety of input formats. - -[Haskell]: http://haskell.org/ -[pandoc]: http://johnmacfarlane.net/pandoc/ - -Features include: - -- easy templating system; -- a simple HTTP server for previewing and compiling your website on the go; -- powerful syntax highlighting; -- modules for common items such as tags and feeds; -- easily extensible. - Installation ------------ Installation is provided using [cabal], and some packages are available for different distributions. - cabal install hakyll + $ cabal install hakyll [cabal]: http://www.haskell.org/cabal/ @@ -50,3 +17,30 @@ Linux distro packages: - [Archlinux (AUR)](https://aur.archlinux.org/packages/haskell-hakyll/) - [Debian unstable](http://packages.debian.org/source/sid/haskell-hakyll) + +Building the example site +------------------------- + +Apart from the main Hakyll library, the cabal package also provided you with an +executable `hakyll-init` to create an example site. This is an easy way to get +started: + + $ hakyll-init my-site + +If `hakyll-init` is not found, you should make sure `$HOME/.cabal/bin` is in +your `$PATH`. + +The file `site.hs` holds the configuration of your site, as an executable +haskell program. We can compile and run it like this: + + $ cd my-site + $ ghc --make site.hs + $ ./site build + +If you installed `hakyll` with a preview server (this is the default), you can +now use + + $ ./site preview + +and have a look at your site at +[http://localhost:8000/](http://localhost:8000/). |