Progressed with CSS layout (I guess)
This commit is contained in:
parent
b4ea1f4a03
commit
0a5e19c004
39
site.hs
39
site.hs
@ -40,11 +40,23 @@ pandocMathCompiler =
|
||||
}
|
||||
in pandocCompilerWith defaultHakyllReaderOptions writerOptions
|
||||
|
||||
config :: Configuration
|
||||
config = defaultConfiguration
|
||||
|
||||
options :: Options
|
||||
options = Options { verbosity = True
|
||||
, optCommand = Watch { host = "0.0.0.0"
|
||||
, port = 8000
|
||||
, no_server = False
|
||||
}
|
||||
}
|
||||
|
||||
-- | Main entry point for generating all code via Hakyll
|
||||
main :: IO ()
|
||||
main = do
|
||||
E.setLocaleEncoding E.utf8
|
||||
hakyll $ do
|
||||
--hakyllWithArgs config options $ do
|
||||
-- Build up tags
|
||||
tags <- buildTags "posts/*" (fromCapture "tags/*.html")
|
||||
let postCtxTags = postCtxWithTags tags
|
||||
@ -89,13 +101,6 @@ main = do
|
||||
>>= loadAndApplyTemplate "templates/default.html" postCtxTags
|
||||
>>= relativizeUrls
|
||||
|
||||
match "works/*" $ do
|
||||
route $ setExtension "html"
|
||||
compile $ pandocMathCompiler
|
||||
>>= loadAndApplyTemplate "templates/post.html" postCtxTags
|
||||
>>= loadAndApplyTemplate "templates/default.html" postCtxTags
|
||||
>>= relativizeUrls
|
||||
|
||||
create ["archive.html"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
@ -127,11 +132,19 @@ main = do
|
||||
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "works/*" $ do
|
||||
route $ setExtension "html"
|
||||
compile $ pandocMathCompiler
|
||||
>>= saveSnapshot "content"
|
||||
>>= loadAndApplyTemplate "templates/post.html" postCtxTags
|
||||
>>= loadAndApplyTemplate "templates/default.html" postCtxTags
|
||||
>>= relativizeUrls
|
||||
|
||||
create ["works.html"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
posts <- loadAll "works/*"
|
||||
let archiveCtx =
|
||||
posts <- recentFirst =<< loadAllSnapshots "works/*" "content"
|
||||
let archiveCtx =
|
||||
listField "works" postCtxTags (return posts) `mappend`
|
||||
constField "title" "Something" `mappend`
|
||||
defaultContext
|
||||
@ -139,8 +152,12 @@ main = do
|
||||
>>= loadAndApplyTemplate "templates/works.html" archiveCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
|
||||
>>= relativizeUrls
|
||||
-- so it seems I have to have a match pattern on
|
||||
-- works/* for the above to actually work?
|
||||
|
||||
-- tried to follow
|
||||
-- https://jaspervdj.be/hakyll/tutorials/05-snapshots-feeds.html
|
||||
-- but I am stuck at this if I clean first & then watch:
|
||||
-- [ERROR] Missing field $description$ in context for item works/2019-10-27-test.md
|
||||
-- For some reason, bodyField just doesn't seem to add the context.
|
||||
|
||||
match "templates/*" $ compile templateCompiler
|
||||
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
<!-- Begin Hakyll template, post-grid.html -->
|
||||
<div class="row">
|
||||
$for(works)$
|
||||
<div class="col-sm-4">
|
||||
<div class="col-sm-6">
|
||||
<h3>$title$</h3>
|
||||
<img src="$img$" class="img-responsive"/>
|
||||
<!-- N.B. use img-fluid for Bootstrap 4 -->
|
||||
<a href="$url$">$title$</a> - $date$
|
||||
<a href="$url$">$date$</a>
|
||||
$body$
|
||||
</div>
|
||||
$endfor$
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user