reorganizing
This commit is contained in:
parent
b987b2ef8a
commit
d44978d713
1 changed files with 32 additions and 23 deletions
55
src/Main.hs
55
src/Main.hs
|
@ -21,28 +21,28 @@ main =
|
||||||
|
|
||||||
--copy fonts, images etc.
|
--copy fonts, images etc.
|
||||||
match
|
match
|
||||||
( "font/*"
|
( "site/font/*"
|
||||||
.||. "images/*"
|
.||. "site/images/*"
|
||||||
.||. "humans.txt"
|
.||. "site/humans.txt"
|
||||||
.||. "94A943E0.asc"
|
.||. "site/94A943E0.asc"
|
||||||
.||. "robots.txt"
|
.||. "site/robots.txt"
|
||||||
.||. "keybase.txt"
|
.||. "site/keybase.txt"
|
||||||
) $ do
|
) $ do
|
||||||
route idRoute
|
route myRoute
|
||||||
compile copyFileCompiler
|
compile copyFileCompiler
|
||||||
|
|
||||||
match "css/*" $ do
|
match "site/css/*" $ do
|
||||||
route idRoute
|
route myRoute
|
||||||
compile compressCssCompiler
|
compile compressCssCompiler
|
||||||
|
|
||||||
-- Build tags
|
-- Build tags
|
||||||
tags <- buildTags "posts/*.md" (fromCapture "tags/*.html")
|
tags <- buildTags "site/posts/*.md" (fromCapture "tags/*.html")
|
||||||
|
|
||||||
--build tagcloud
|
--build tagcloud
|
||||||
let baseCtx = tagCloudField "tagcloud" 80.0 200.0 tags <>
|
let baseCtx = tagCloudField "tagcloud" 80.0 200.0 tags <>
|
||||||
defaultContext
|
defaultContext
|
||||||
|
|
||||||
match "index.md" $ do
|
match "site/index.md" $ do
|
||||||
route $ setExtension "html"
|
route $ setExtension "html"
|
||||||
compile $ do
|
compile $ do
|
||||||
posts <- fmap (take 5) . recentFirst =<< loadAll "posts/*"
|
posts <- fmap (take 5) . recentFirst =<< loadAll "posts/*"
|
||||||
|
@ -55,26 +55,30 @@ main =
|
||||||
>>= loadAndApplyTemplate "templates/default.html" baseCtx
|
>>= loadAndApplyTemplate "templates/default.html" baseCtx
|
||||||
>>= relativizeUrls
|
>>= relativizeUrls
|
||||||
|
|
||||||
match (fromList ["about.md", "imprint.md", "contact.md"]) $ do
|
match (fromList
|
||||||
route $ setExtension "html"
|
[ "site/about.md"
|
||||||
compile $ pandocCompiler
|
, "site/imprint.md"
|
||||||
>>= loadAndApplyTemplate "templates/default.html" baseCtx
|
, "site/contact.md"
|
||||||
>>= relativizeUrls
|
]) $ do
|
||||||
|
route $ myRoute `composeRoutes` setExtension "html"
|
||||||
|
compile $ pandocCompiler
|
||||||
|
>>= loadAndApplyTemplate "templates/default.html" baseCtx
|
||||||
|
>>= relativizeUrls
|
||||||
|
|
||||||
match "404.md" $ do
|
match "site/404.md" $ do
|
||||||
route $ setExtension "html"
|
route $ myRoute `composeRoutes` setExtension "html"
|
||||||
compile $ pandocCompiler
|
compile $ pandocCompiler
|
||||||
>>= loadAndApplyTemplate "templates/default.html" baseCtx
|
>>= loadAndApplyTemplate "templates/default.html" baseCtx
|
||||||
|
|
||||||
is <- sortIdentifiersByDate <$> getMatches "posts/*.md"
|
is <- sortIdentifiersByDate <$> getMatches "site/posts/*.md"
|
||||||
|
|
||||||
pages <- buildPaginateWith
|
pages <- buildPaginateWith
|
||||||
(liftM (paginateEvery 1) . sortRecentFirst)
|
(liftM (paginateEvery 1) . sortRecentFirst)
|
||||||
"posts/*.md"
|
"site/posts/*.md"
|
||||||
(\n -> is !! (n - 1))
|
(\n -> is !! (n - 1))
|
||||||
|
|
||||||
paginateRules pages $ \num _ -> do
|
paginateRules pages $ \num _ -> do
|
||||||
route $ setExtension "html"
|
route $ myRoute `composeRoutes` setExtension "html"
|
||||||
compile $ do
|
compile $ do
|
||||||
ident <- getUnderlying
|
ident <- getUnderlying
|
||||||
title <- getMetadataField' ident "title"
|
title <- getMetadataField' ident "title"
|
||||||
|
@ -93,7 +97,7 @@ main =
|
||||||
tagsRules tags $ \tag pattern -> do
|
tagsRules tags $ \tag pattern -> do
|
||||||
let title = "Posts tagged " ++ tag ++ ":"
|
let title = "Posts tagged " ++ tag ++ ":"
|
||||||
-- Copied from posts, need to refactor
|
-- Copied from posts, need to refactor
|
||||||
route idRoute
|
route myRoute
|
||||||
compile $ do
|
compile $ do
|
||||||
posts <- recentFirst =<< loadAll pattern
|
posts <- recentFirst =<< loadAll pattern
|
||||||
let ctx = constField "title" title <>
|
let ctx = constField "title" title <>
|
||||||
|
@ -107,7 +111,7 @@ main =
|
||||||
create ["archive.html"] $ do
|
create ["archive.html"] $ do
|
||||||
route idRoute
|
route idRoute
|
||||||
compile $ do
|
compile $ do
|
||||||
posts <- recentFirst =<< loadAll "posts/*"
|
posts <- recentFirst =<< loadAll "site/posts/*"
|
||||||
let archiveCtx = listField "posts" (postCtx tags) (return posts) <>
|
let archiveCtx = listField "posts" (postCtx tags) (return posts) <>
|
||||||
constField "title" "Archives" <>
|
constField "title" "Archives" <>
|
||||||
baseCtx
|
baseCtx
|
||||||
|
@ -185,3 +189,8 @@ config :: Configuration
|
||||||
config = defaultConfiguration
|
config = defaultConfiguration
|
||||||
{ deployCommand = "rsync --del --checksum -ave 'ssh -p 5555' \\_site/* nek0@chelnok.de:/home/nek0/www/blog"
|
{ deployCommand = "rsync --del --checksum -ave 'ssh -p 5555' \\_site/* nek0@chelnok.de:/home/nek0/www/blog"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
myRoute :: Routes
|
||||||
|
myRoute = gsubRoute "site/" (const "")
|
||||||
|
|
Loading…
Reference in a new issue