summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBenedict Eastaugh <benedict@eastaugh.net>2011-03-28 15:22:43 +0100
committerBenedict Eastaugh <benedict@eastaugh.net>2011-03-29 17:30:23 +0100
commitc288567388c6ebcb75f369bee60f19664e855c9c (patch)
treef67d985c39b076b56319cbd57af6208fd85e9a00 /examples
parent9ddde6c0fac02268ebf0c22a0ee3e22079a5d124 (diff)
downloadhakyll-c288567388c6ebcb75f369bee60f19664e855c9c.tar.gz
Update morepages example to work with Hakyll 3.
Diffstat (limited to 'examples')
-rw-r--r--examples/morepages/about.markdown7
-rw-r--r--examples/morepages/css/default.css1
-rw-r--r--examples/morepages/footer.markdown5
-rw-r--r--examples/morepages/hakyll.hs41
-rw-r--r--examples/morepages/index.markdown7
-rw-r--r--examples/morepages/products.markdown7
-rw-r--r--examples/morepages/templates/default.html19
7 files changed, 54 insertions, 33 deletions
diff --git a/examples/morepages/about.markdown b/examples/morepages/about.markdown
index 59d1aca..65d8e9f 100644
--- a/examples/morepages/about.markdown
+++ b/examples/morepages/about.markdown
@@ -1,24 +1,25 @@
---
title: About
+---
---- section1
## Mattis
+
Nullam imperdiet sodales orci vitae molestie. Nunc quam orci, pharetra a
rhoncus vitae, eleifend id felis. Suspendisse potenti. Etiam vitae urna orci.
Quisque pellentesque dignissim felis, egestas tempus urna luctus vitae. In hac
habitasse platea dictumst. Morbi fringilla mattis odio, et mattis tellus
accumsan vitae.
---- section2
## Orci
+
Vivamus eget mauris sit amet nulla laoreet lobortis. Nulla in diam elementum
risus convallis commodo. Cras vehicula varius dui vitae facilisis. Proin
elementum libero eget leo aliquet quis euismod orci vestibulum. Duis rhoncus
lorem consequat tellus vestibulum aliquam. Quisque orci orci, malesuada porta
blandit et, interdum nec magna.
---- section3
## Augue
+
In urna ante, pulvinar et imperdiet nec, fermentum ac tortor. Cras tristique
pellentesque euismod. Pellentesque est ante, sagittis vitae vehicula vitae,
ullamcorper eget lectus. Curabitur egestas accumsan leo, ac ullamcorper nibh
diff --git a/examples/morepages/css/default.css b/examples/morepages/css/default.css
index 0376cae..76607cf 100644
--- a/examples/morepages/css/default.css
+++ b/examples/morepages/css/default.css
@@ -24,4 +24,5 @@ div.column {
div#footer {
clear: both;
+ border-top: 4px solid black;
}
diff --git a/examples/morepages/footer.markdown b/examples/morepages/footer.markdown
index 408541c..afcb47d 100644
--- a/examples/morepages/footer.markdown
+++ b/examples/morepages/footer.markdown
@@ -1,4 +1,7 @@
---- footer
+---
+title: Footer
+---
+
## Sapien
In hac habitasse platea dictumst. Cras placerat felis nec risus varius in
diff --git a/examples/morepages/hakyll.hs b/examples/morepages/hakyll.hs
index 3329b55..d62f8a8 100644
--- a/examples/morepages/hakyll.hs
+++ b/examples/morepages/hakyll.hs
@@ -1,13 +1,28 @@
-import Text.Hakyll (hakyll)
-import Text.Hakyll.File (directory)
-import Text.Hakyll.Render (css, static, renderChain)
-import Text.Hakyll.CreateContext (createPage, combine)
-
-main = hakyll "http://example.com" $ do
- directory css "css"
- render "about.markdown"
- render "index.markdown"
- render "products.markdown"
- where
- render = renderChain ["templates/default.html"] . withFooter . createPage
- withFooter = flip combine $ createPage "footer.markdown"
+{-# LANGUAGE OverloadedStrings, Arrows #-}
+module Main where
+
+import Control.Monad (forM_)
+import Control.Arrow (arr, (>>>))
+
+import Hakyll
+
+main :: IO ()
+main = hakyll $ do
+ -- Compress CSS
+ route "css/*" idRoute
+ compile "css/*" compressCssCompiler
+
+ -- Render static pages
+ forM_ ["about.markdown", "index.markdown", "products.markdown"] $ \p -> do
+ route p $ setExtension ".html"
+ compile p $
+ pageCompiler
+ >>> requireA "footer.markdown" (setFieldA "footer" $ arr pageBody)
+ >>> applyTemplateCompiler "templates/default.html"
+ >>> relativizeUrlsCompiler
+
+ -- Compile footer
+ compile "footer.markdown" pageCompiler
+
+ -- Read templates
+ compile "templates/*" templateCompiler
diff --git a/examples/morepages/index.markdown b/examples/morepages/index.markdown
index 4a2dc80..16fffd6 100644
--- a/examples/morepages/index.markdown
+++ b/examples/morepages/index.markdown
@@ -1,14 +1,15 @@
---
title: Home
+---
---- section1
## Purus
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempor, urna et
auctor tincidunt, eros mauris facilisis purus, eget sollicitudin leo massa sit
amet ipsum. Vivamus eu massa in urna vehicula rutrum eget sit amet purus.
---- section2
## Ligula
+
Mauris sit amet justo mi. Curabitur vel quam felis. In hac habitasse platea
dictumst. Etiam nec consequat risus. Donec consequat est vitae neque fermentum
feugiat nec ac nibh. Nulla rhoncus, odio quis scelerisque rutrum, metus sem
@@ -16,8 +17,8 @@ tempor ante, a ornare ipsum felis sed ligula. Morbi urna lectus, scelerisque
non pharetra in, rutrum quis ligula. Phasellus semper ullamcorper arcu eu
auctor.
---- section3
## Justo
+
Aliquam sagittis tincidunt libero ut elementum. Ut sit amet vestibulum metus.
Ut aliquet congue neque eu tincidunt. Integer eu elit sed massa sollicitudin
vehicula nec ut sem. Cras euismod enim eget purus lacinia non feugiat urna
diff --git a/examples/morepages/products.markdown b/examples/morepages/products.markdown
index 7032479..68ffd36 100644
--- a/examples/morepages/products.markdown
+++ b/examples/morepages/products.markdown
@@ -1,22 +1,23 @@
---
title: Products
+---
---- section1
## Lacus
+
Etiam condimentum auctor semper. Donec lobortis, magna id sodales sollicitudin,
lectus mi egestas nulla, pulvinar lobortis nunc eros id nisl. Curabitur
imperdiet, erat at accumsan vulputate, purus nunc blandit nulla, dictum
vestibulum sem lorem eget ipsum.
---- section2
## Vitae
+
Integer ut dui eu felis mollis vestibulum. Etiam at nibh id diam aliquet
vestibulum sit amet a nibh. Aliquam erat volutpat. Etiam vitae nulla at dolor
fringilla tempor ut a nunc. Pellentesque elementum elit lorem. Quisque nec
ligula ipsum. Nunc augue lacus, ullamcorper vel dapibus in, mattis eget elit.
---- section3
## Feugiat
+
Pellentesque enim dui, interdum elementum vehicula luctus, feugiat vitae arcu.
Vestibulum ut felis justo. Quisque vestibulum mauris eget ipsum luctus
consequat. Nunc tincidunt, turpis ut fermentum dapibus,
diff --git a/examples/morepages/templates/default.html b/examples/morepages/templates/default.html
index d01722b..8fcd9cb 100644
--- a/examples/morepages/templates/default.html
+++ b/examples/morepages/templates/default.html
@@ -4,20 +4,19 @@
<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" />
+ <title>MyAweSomeCompany - $title$</title>
+ <link rel="stylesheet" type="text/css" href="/css/default.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/products.html">Products</a>
+ <a href="/">Home</a>
+ <a href="/about.html">About</a>
+ <a href="/products.html">Products</a>
</div>
- <div class="column"> $section1 </div>
- <div class="column"> $section2 </div>
- <div class="column"> $section3 </div>
- <div id="footer"> $footer </div>
+ $body$
+
+ <div id="footer"> $footer$ </div>
</body>
</html>