diff --git a/rauhala.info/templates/default.html b/rauhala.info/templates/default.html
index a67e927..182f42f 100644
--- a/rauhala.info/templates/default.html
+++ b/rauhala.info/templates/default.html
@@ -16,6 +16,8 @@
diff --git a/rauhala.info/templates/guides.html b/rauhala.info/templates/guides.html
deleted file mode 100644
index 579fb96..0000000
--- a/rauhala.info/templates/guides.html
+++ /dev/null
@@ -1,3 +0,0 @@
-A list of small and big guides.
-
-$partial("templates/post-list.html")$
diff --git a/rauhala.info/templates/post-list.html b/rauhala.info/templates/post-list.html
index 3a50f28..71cf1b9 100644
--- a/rauhala.info/templates/post-list.html
+++ b/rauhala.info/templates/post-list.html
@@ -1,7 +1,7 @@
diff --git a/rauhala.info/templates/post.html b/rauhala.info/templates/post.html
index 1f717cb..c7b1a63 100644
--- a/rauhala.info/templates/post.html
+++ b/rauhala.info/templates/post.html
@@ -1,9 +1,6 @@
$body$
diff --git a/site/app/site.hs b/site/app/site.hs
index 161c89e..ed62128 100644
--- a/site/app/site.hs
+++ b/site/app/site.hs
@@ -32,16 +32,40 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
route idRoute
compile compressCssCompiler
+ match "posts/*" $ do
+ route $ setExtension "html"
+ compile $ pandocCompiler
+ >>= loadAndApplyTemplate "templates/post.html" postContext
+ >>= loadAndApplyTemplate "templates/default.html" defaultContext
+ >>= relativizeUrls
+
+
match (fromList ["index.markdown", "contact.markdown"]) $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
+ create ["posts.html"] $ do
+ route idRoute
+ compile $ do
+ let postsContext =
+ listField "posts" postContext posts
+ <> constField "title" "Posts"
+ <> defaultContext
+ posts = recentFirst =<< loadAll "posts/*"
+ makeItem ""
+ >>= loadAndApplyTemplate "templates/post-list.html" postsContext
+ >>= loadAndApplyTemplate "templates/default.html" postsContext
+ >>= relativizeUrls
+
match "templates/*" $ compile templateBodyCompiler
where
+ postContext :: Context String
+ postContext = dateField "date" "%B %e, %Y" <> defaultContext
+ ignore :: FilePath -> Bool
ignore path = any ($ takeFileName path)
[ ("." `isPrefixOf`)
, ("#" `isPrefixOf`)
diff --git a/site/default.nix b/site/default.nix
index 17ed554..d5a9adf 100644
--- a/site/default.nix
+++ b/site/default.nix
@@ -1,10 +1,10 @@
-{ mkDerivation, base, hakyll, stdenv, time }:
+{ mkDerivation, base, filepath, hakyll, stdenv, time }:
mkDerivation {
pname = "site";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
- executableHaskellDepends = [ base hakyll time ];
+ executableHaskellDepends = [ base filepath hakyll time ];
license = stdenv.lib.licenses.bsd3;
}
diff --git a/site/site.cabal b/site/site.cabal
index 8795d02..b28fa84 100644
--- a/site/site.cabal
+++ b/site/site.cabal
@@ -13,5 +13,6 @@ executable site
build-depends: base == 4.*
, hakyll >= 4.10
, time
+ , filepath
ghc-options: -threaded
default-language: Haskell2010