From 251e1126c38eafca2890c3bfd268956624cf3397 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 7 Dec 2012 11:36:20 +0100 Subject: Bit of work on example site --- data/example/css/default.css | 43 +++++++++++++++++----- .../example/posts/2012-11-28-example-post.markdown | 5 +++ .../posts/2012-12-07-running-hakyll.markdown | 7 ++++ data/example/site.hs | 22 ++++++++++- data/example/templates/default.html | 22 ++++++++--- 5 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 data/example/posts/2012-11-28-example-post.markdown create mode 100644 data/example/posts/2012-12-07-running-hakyll.markdown (limited to 'data') diff --git a/data/example/css/default.css b/data/example/css/default.css index 3bfeeaf..9eb8a27 100644 --- a/data/example/css/default.css +++ b/data/example/css/default.css @@ -1,19 +1,44 @@ body { - width: 600px; + color: black; + font-size: 16px; margin: 0px auto 0px auto; + width: 600px; } -div#navigation { - text-align: center; - border-bottom: 4px solid black; +div#header { + border-bottom: 2px solid black; + margin-bottom: 30px; + padding: 12px 0px 12px 0px; +} + +div#logo a { + color: black; + float: left; + font-size: 18px; + font-weight: bold; + text-decoration: none; +} + +div#header #navigation { + text-align: right; } -div#navigation a { - color: white; +div#header #navigation a { + color: black; + font-size: 18px; + font-weight: bold; + margin-left: 12px; text-decoration: none; - background-color: black; - padding: 3px 10px 3px 10px; - margin: 0px 10px 0px 10px; + text-transform: uppercase; +} + +div#footer { + border-top: solid 2px black; + color: #555; + font-size: 12px; + margin-top: 30px; + padding: 12px 0px 12px 0px; + text-align: right; } div.figure { diff --git a/data/example/posts/2012-11-28-example-post.markdown b/data/example/posts/2012-11-28-example-post.markdown new file mode 100644 index 0000000..9b09631 --- /dev/null +++ b/data/example/posts/2012-11-28-example-post.markdown @@ -0,0 +1,5 @@ +--- +title: An example post +--- + +This is an example post. diff --git a/data/example/posts/2012-12-07-running-hakyll.markdown b/data/example/posts/2012-12-07-running-hakyll.markdown new file mode 100644 index 0000000..cc1ea65 --- /dev/null +++ b/data/example/posts/2012-12-07-running-hakyll.markdown @@ -0,0 +1,7 @@ +--- +title: Up and running with Hakyll! +--- + +# Up and running with Hakyll! + +Congratulations, you succesfully compiled your Hakyll blog. diff --git a/data/example/site.hs b/data/example/site.hs index df53095..ccf8ff8 100644 --- a/data/example/site.hs +++ b/data/example/site.hs @@ -1,6 +1,8 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} import Hakyll +import Data.List (sort) +import Control.Applicative ((<$>)) -------------------------------------------------------------------------------- @@ -14,10 +16,28 @@ main = hakyll $ do route idRoute compile compressCssCompiler - match (fromList ["about.rst", "index.markdown", "code.lhs"]) $ do + match (fromList ["about.rst", "code.lhs"]) $ do route $ setExtension "html" compile $ pageCompiler >>= requireApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls + match "posts/*" $ do + route $ setExtension "html" + compile $ do + post <- pageCompiler + saveSnapshot "content" post + return post + >>= requireApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls + + match "index.html" $ do + route idRoute + compile $ do + posts <- sort <$> getMatches "posts/*" + post <- requireSnapshot (head posts) "content" + return post + >>= requireApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls + match "templates/*" $ compile templateCompiler diff --git a/data/example/templates/default.html b/data/example/templates/default.html index 44d1cd0..4b7d8af 100644 --- a/data/example/templates/default.html +++ b/data/example/templates/default.html @@ -9,13 +9,23 @@ -

MyAweSomeCompany - $title$

-