on master help sign in
Bit of work on example site
commit251e1126c38eafca2890c3bfd268956624cf3397 authorJasper Van der Jeugt <m@jaspervdj.be> dateFri 7 Dec 2012, 11:36 (14 years ago) parent7d20671
5 files changed+83−16
data/example/css/default.css+34−9 data/example/posts/2012-11-28-example-post.markdown+5 data/example/posts/2012-12-07-running-hakyll.markdown+7 data/example/site.hs+21−1 data/example/templates/default.html+16−6
data/example/css/default.css+34−9
@@ -1,19 +1,44 @@
11body {
2− width: 600px;
2+ color: black;
3+ font-size: 16px;
34 margin: 0px auto 0px auto;
5+ width: 600px;
46}
57
6−div#navigation {
7− text-align: center;
8− border-bottom: 4px solid black;
8+div#header {
9+ border-bottom: 2px solid black;
10+ margin-bottom: 30px;
11+ padding: 12px 0px 12px 0px;
12+}
13+
14+div#logo a {
15+ color: black;
16+ float: left;
17+ font-size: 18px;
18+ font-weight: bold;
19+ text-decoration: none;
20+}
21+
22+div#header #navigation {
23+ text-align: right;
924}
1025
11−div#navigation a {
12− color: white;
26+div#header #navigation a {
27+ color: black;
28+ font-size: 18px;
29+ font-weight: bold;
30+ margin-left: 12px;
1331 text-decoration: none;
14− background-color: black;
15− padding: 3px 10px 3px 10px;
16− margin: 0px 10px 0px 10px;
32+ text-transform: uppercase;
33+}
34+
35+div#footer {
36+ border-top: solid 2px black;
37+ color: #555;
38+ font-size: 12px;
39+ margin-top: 30px;
40+ padding: 12px 0px 12px 0px;
41+ text-align: right;
1742}
1843
1944div.figure {
data/example/posts/2012-11-28-example-post.markdownnew file+5
@@ -0,0 +1,5 @@
1+---
2+title: An example post
3+---
4+
5+This is an example post.
data/example/posts/2012-12-07-running-hakyll.markdownnew file+7
@@ -0,0 +1,7 @@
1+---
2+title: Up and running with Hakyll!
3+---
4+
5+# Up and running with Hakyll!
6+
7+Congratulations, you succesfully compiled your Hakyll blog.
data/example/site.hs+21−1
@@ -1,6 +1,8 @@
11--------------------------------------------------------------------------------
22{-# LANGUAGE OverloadedStrings #-}
33import Hakyll
4+import Data.List (sort)
5+import Control.Applicative ((<$>))
46
57
68--------------------------------------------------------------------------------
@@ -14,10 +16,28 @@ main = hakyll $ do
1416 route idRoute
1517 compile compressCssCompiler
1618
17− match (fromList ["about.rst", "index.markdown", "code.lhs"]) $ do
19+ match (fromList ["about.rst", "code.lhs"]) $ do
1820 route $ setExtension "html"
1921 compile $ pageCompiler
2022 >>= requireApplyTemplate "templates/default.html" defaultContext
2123 >>= relativizeUrls
2224
25+ match "posts/*" $ do
26+ route $ setExtension "html"
27+ compile $ do
28+ post <- pageCompiler
29+ saveSnapshot "content" post
30+ return post
31+ >>= requireApplyTemplate "templates/default.html" defaultContext
32+ >>= relativizeUrls
33+
34+ match "index.html" $ do
35+ route idRoute
36+ compile $ do
37+ posts <- sort <$> getMatches "posts/*"
38+ post <- requireSnapshot (head posts) "content"
39+ return post
40+ >>= requireApplyTemplate "templates/default.html" defaultContext
41+ >>= relativizeUrls
42+
2343 match "templates/*" $ compile templateCompiler
data/example/templates/default.html+16−6
@@ -9,13 +9,23 @@
99 <link rel="stylesheet" type="text/css" href="/css/syntax.css" />
1010 </head>
1111 <body>
12− <h1>MyAweSomeCompany - $title$</h1>
13− <div id="navigation">
14− <a href="/">Home</a>
15− <a href="/about.html">About</a>
16− <a href="/code.html">Code</a>
12+ <div id="header">
13+ <div id="logo">
14+ <a href="/">My Hakyll Blog</a>
15+ </div>
16+ <div id="navigation">
17+ <a href="/">Home</a>
18+ <a href="/about.html">About</a>
19+ <a href="/code.html">Code</a>
20+ </div>
1721 </div>
1822
19− $body$
23+ <div id="content">
24+ $body$
25+ </div>
26+ <div id="footer">
27+ Site proudly generated by
28+ <a href="http://jaspervdj.be/hakyll">Hakyll</a>
29+ </div>
2030 </body>
2131</html>