less soykaffy code

This commit is contained in:
Thorn Avery 2018-08-19 13:17:10 +12:00
parent d5ba9e0a3c
commit a4dd7aed4d
5 changed files with 20 additions and 20 deletions

View File

@ -3,3 +3,7 @@
## 0.1.0.0 -- 2018-08-18 ## 0.1.0.0 -- 2018-08-18
* First version, counting from when I got around to putting it on git. * First version, counting from when I got around to putting it on git.
## 0.1.0.1 -- 2018-08-19
* Cleaned up the code a bit

View File

@ -1,3 +1,7 @@
---
title: Archives
---
you access archives and find: you access archives and find:
* An [SSL Endorsement](https://netrunnerdb.com/en/card/21038) * An [SSL Endorsement](https://netrunnerdb.com/en/card/21038)

View File

@ -1,7 +1,7 @@
{ mkDerivation, base, filepath, hakyll, stdenv }: { mkDerivation, base, filepath, hakyll, stdenv }:
mkDerivation { mkDerivation {
pname = "rf"; pname = "rf";
version = "0.1.0.0"; version = "0.1.0.1";
src = ./.; src = ./.;
isLibrary = false; isLibrary = false;
isExecutable = true; isExecutable = true;

View File

@ -2,7 +2,7 @@
-- see http://haskell.org/cabal/users-guide/ -- see http://haskell.org/cabal/users-guide/
name: rf name: rf
version: 0.1.0.0 version: 0.1.0.1
synopsis: tA's blog synopsis: tA's blog
-- description: -- description:
homepage: regularflolloping.com homepage: regularflolloping.com

28
site.hs
View File

@ -1,7 +1,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
import Hakyll import Hakyll
import Data.Monoid (mappend) import Data.Monoid ((<>))
import Data.List (sortBy,isSuffixOf) import Data.List (sortBy,isSuffixOf)
import System.FilePath.Posix (takeBaseName,takeDirectory,(</>)) import System.FilePath.Posix (takeBaseName,takeDirectory,(</>))
import GHC.IO.Encoding import GHC.IO.Encoding
@ -14,10 +14,6 @@ main = do
route idRoute route idRoute
compile copyFileCompiler compile copyFileCompiler
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do match "css/*" $ do
route idRoute route idRoute
compile compressCssCompiler compile compressCssCompiler
@ -25,23 +21,22 @@ main = do
match (fromList ["about.md", "contact.md"]) $ do match (fromList ["about.md", "contact.md"]) $ do
route $ cleanRoute route $ cleanRoute
compile $ pandocCompiler compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext >>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls >>= relativizeUrls
>>= cleanIndexUrls >>= cleanIndexUrls
match "archive.md" $ do match "archive.md" $ do
route $ cleanRoute route $ cleanRoute
compile $ pandocCompiler compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/archive.html" defaultContext >>= loadAndApplyTemplate "templates/archive.html" ctx
>>= relativizeUrls >>= relativizeUrls
>>= cleanIndexUrls >>= cleanIndexUrls
compile $ do compile $ do
posts <- recentFirst =<< loadAll "posts/*" posts <- recentFirst =<< loadAll "posts/*"
let archiveCtx = let archiveCtx =
listField "posts" postCtx (return posts) `mappend` listField "posts" postCtx (return posts) <>
constField "title" "Archives" `mappend` ctx
defaultContext
pandocCompiler pandocCompiler
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx >>= loadAndApplyTemplate "templates/archive.html" archiveCtx
>>= loadAndApplyTemplate "templates/default.html" archiveCtx >>= loadAndApplyTemplate "templates/default.html" archiveCtx
@ -57,18 +52,13 @@ main = do
>>= cleanIndexUrls >>= cleanIndexUrls
>>= cleanIndexHtmls >>= cleanIndexHtmls
create ["archive/index.html"] $ do
route idRoute
match "index.html" $ do match "index.html" $ do
route idRoute route idRoute
compile $ do compile $ do
posts <- recentFirst =<< loadAll "posts/*" posts <- recentFirst =<< loadAll "posts/*"
let indexCtx = let indexCtx =
listField "posts" postCtx (return posts) `mappend` listField "posts" postCtx (return posts) <>
constField "title" "Home" `mappend`
defaultContext defaultContext
getResourceBody getResourceBody
>>= applyAsTemplate indexCtx >>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx
@ -78,10 +68,12 @@ main = do
match "templates/*" $ compile templateBodyCompiler match "templates/*" $ compile templateBodyCompiler
ctx :: Context String
ctx = defaultContext
postCtx :: Context String postCtx :: Context String
postCtx = postCtx =
dateField "date" "%B %e, %Y" `mappend` (dateField "date" "%B %e, %Y") <> ctx
defaultContext
cleanRoute :: Routes cleanRoute :: Routes
cleanRoute = customRoute createIndexRoute cleanRoute = customRoute createIndexRoute