summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-24 09:25:11 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-24 09:25:11 +0000
commit8152c250c54b6be6533eecf393d38c83b4c66348 (patch)
tree6fcde0ce3914d61e8bc0414b01b686dd77d805c1 /src
parent68b7a70cca25a891df55721bf104fe36c8cb862a (diff)
downloaddirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar.gz
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar.bz2
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar.xz
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.zip
Site redesign
Diffstat (limited to 'src')
-rw-r--r--src/Site.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Site.hs b/src/Site.hs
index 98a598f..c1e4854 100644
--- a/src/Site.hs
+++ b/src/Site.hs
@@ -9,13 +9,16 @@ import Data.Maybe (mapMaybe, fromMaybe)
9import Data.Map (Map) 9import Data.Map (Map)
10import qualified Data.Map as Map 10import qualified Data.Map as Map
11import qualified Data.Set as Set 11import qualified Data.Set as Set
12import Data.List (take, reverse, nub, groupBy, concatMap) 12import Data.List (take, reverse, nub, groupBy, concatMap, intersperse)
13import Data.Function (on) 13import Data.Function (on)
14import Data.Default 14import Data.Default
15import Text.Pandoc 15import Text.Pandoc
16import Text.Pandoc.Walk (query, walkM) 16import Text.Pandoc.Walk (query, walkM)
17import Text.Pandoc.Error 17import Text.Pandoc.Error
18import Control.Applicative (Alternative(..), Applicative(..)) 18import Control.Applicative (Alternative(..), Applicative(..))
19import Text.Blaze.Html (toHtml, toValue, (!))
20import qualified Text.Blaze.Html5 as H
21import qualified Text.Blaze.Html5.Attributes as A
19 22
20import System.FilePath (takeBaseName, (</>), (<.>)) 23import System.FilePath (takeBaseName, (</>), (<.>))
21 24
@@ -45,16 +48,20 @@ main = hakyllWith config $ do
45 saveSnapshot "alignment" $ fmap snd item 48 saveSnapshot "alignment" $ fmap snd item
46 return $ fmap fst item 49 return $ fmap fst item
47 50
51 tags <- buildTags "posts/*" tagTranslation' >>= addTag "All Posts" "posts/*"
52
48 match "posts/*" $ do 53 match "posts/*" $ do
49 route $ setExtension ".html" 54 route $ setExtension ".html"
50 compile $ do 55 compile $ do
56 let ctx = mconcat [ defaultContext
57 , dateField "published" "%F"
58 , tagsFieldWith getTags (\tag _ -> Just . H.li $ H.a ! A.href (toValue . toUrl $ "tags" </> tagTranslation tag <.> "html") $ toHtml tag) (mconcat . intersperse "\n") "tagList" tags
59 ]
51 getResourceBody >>= saveSnapshot "content" 60 getResourceBody >>= saveSnapshot "content"
52 pandocCompilerWithTransformM defaultHakyllReaderOptions defaultHakyllWriterOptions mathTransform 61 pandocCompilerWithTransformM defaultHakyllReaderOptions defaultHakyllWriterOptions mathTransform
53 >>= loadAndApplyTemplate "templates/default.html" defaultContext 62 >>= loadAndApplyTemplate "templates/default.html" ctx
54 >>= relativizeUrls 63 >>= relativizeUrls
55 64
56 tags <- buildTags "posts/*" tagTranslation' >>= addTag "All Posts" "posts/*"
57
58 tagsRules tags $ \tag pattern -> do 65 tagsRules tags $ \tag pattern -> do
59 route idRoute 66 route idRoute
60 compile $ do 67 compile $ do
@@ -89,7 +96,9 @@ main = hakyllWith config $ do
89 , defaultContext 96 , defaultContext
90 ] 97 ]
91 item <- getResourceBody 98 item <- getResourceBody
92 pandocCompilerWith def (def { writerEmailObfuscation = NoObfuscation }) 99 {-pandocCompilerWith def (def { writerEmailObfuscation = NoObfuscation })
100 >>=-}
101 makeItem ""
93 >>= loadAndApplyTemplate "templates/index.html" ctx 102 >>= loadAndApplyTemplate "templates/index.html" ctx
94 >>= loadAndApplyTemplate "templates/default.html" ctx 103 >>= loadAndApplyTemplate "templates/default.html" ctx
95 >>= relativizeUrls 104 >>= relativizeUrls