Update brochure example to hakyll3

This commit is contained in:
Jasper Van der Jeugt 2011-02-10 12:29:40 +01:00
parent 8cec091e04
commit f08b2222ca
2 changed files with 25 additions and 20 deletions

View file

@ -1,13 +1,18 @@
import Text.Hakyll (hakyll)
import Text.Hakyll.File (directory)
import Text.Hakyll.Render (css, static, renderChain)
import Text.Hakyll.CreateContext (createPage)
{-# LANGUAGE OverloadedStrings #-}
import Control.Arrow ((>>>))
import Control.Monad (forM_)
main = hakyll "http://example.com" $ do
directory css "css"
render "about.rst"
render "index.markdown"
render "code.lhs"
where
render = renderChain ["templates/default.html"]
. createPage
import Hakyll
main :: IO ()
main = hakyll $ do
route "css/*" idRoute
compile "css/*" defaultCompressCss
compile "templates/*" defaultTemplateRead
forM_ ["about.rst", "index.markdown", "code.lhs"] $ \page -> do
route page $ setExtension "html"
compile page $ defaultPageRead
>>> require "templates/default.html" (flip applyTemplate)
>>> defaultRelativizeUrls

View file

@ -4,18 +4,18 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MyAweSomeCompany - $title</title>
<link rel="stylesheet" type="text/css" href="$root/css/default.css" />
<link rel="stylesheet" type="text/css" href="$root/css/syntax.css" />
<title>MyAweSomeCompany - $title$</title>
<link rel="stylesheet" type="text/css" href="/css/default.css" />
<link rel="stylesheet" type="text/css" href="/css/syntax.css" />
</head>
<body>
<h1>MyAweSomeCompany - $title</h1>
<h1>MyAweSomeCompany - $title$</h1>
<div id="navigation">
<a href="$root/index.html">Home</a>
<a href="$root/about.html">About</a>
<a href="$root/code.html">Code</a>
<a href="/index.html">Home</a>
<a href="/about.html">About</a>
<a href="/code.html">Code</a>
</div>
$body
$body$
</body>
</html>