Progressed with CSS layout (I guess)
This commit is contained in:
parent
b4ea1f4a03
commit
0a5e19c004
37
site.hs
37
site.hs
@ -40,11 +40,23 @@ pandocMathCompiler =
|
|||||||
}
|
}
|
||||||
in pandocCompilerWith defaultHakyllReaderOptions writerOptions
|
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 entry point for generating all code via Hakyll
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
E.setLocaleEncoding E.utf8
|
E.setLocaleEncoding E.utf8
|
||||||
hakyll $ do
|
hakyll $ do
|
||||||
|
--hakyllWithArgs config options $ do
|
||||||
-- Build up tags
|
-- Build up tags
|
||||||
tags <- buildTags "posts/*" (fromCapture "tags/*.html")
|
tags <- buildTags "posts/*" (fromCapture "tags/*.html")
|
||||||
let postCtxTags = postCtxWithTags tags
|
let postCtxTags = postCtxWithTags tags
|
||||||
@ -89,13 +101,6 @@ main = do
|
|||||||
>>= loadAndApplyTemplate "templates/default.html" postCtxTags
|
>>= loadAndApplyTemplate "templates/default.html" postCtxTags
|
||||||
>>= relativizeUrls
|
>>= relativizeUrls
|
||||||
|
|
||||||
match "works/*" $ do
|
|
||||||
route $ setExtension "html"
|
|
||||||
compile $ pandocMathCompiler
|
|
||||||
>>= loadAndApplyTemplate "templates/post.html" postCtxTags
|
|
||||||
>>= loadAndApplyTemplate "templates/default.html" postCtxTags
|
|
||||||
>>= relativizeUrls
|
|
||||||
|
|
||||||
create ["archive.html"] $ do
|
create ["archive.html"] $ do
|
||||||
route idRoute
|
route idRoute
|
||||||
compile $ do
|
compile $ do
|
||||||
@ -127,10 +132,18 @@ main = do
|
|||||||
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
||||||
>>= relativizeUrls
|
>>= 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
|
create ["works.html"] $ do
|
||||||
route idRoute
|
route idRoute
|
||||||
compile $ do
|
compile $ do
|
||||||
posts <- loadAll "works/*"
|
posts <- recentFirst =<< loadAllSnapshots "works/*" "content"
|
||||||
let archiveCtx =
|
let archiveCtx =
|
||||||
listField "works" postCtxTags (return posts) `mappend`
|
listField "works" postCtxTags (return posts) `mappend`
|
||||||
constField "title" "Something" `mappend`
|
constField "title" "Something" `mappend`
|
||||||
@ -139,8 +152,12 @@ main = do
|
|||||||
>>= loadAndApplyTemplate "templates/works.html" archiveCtx
|
>>= loadAndApplyTemplate "templates/works.html" archiveCtx
|
||||||
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
|
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
|
||||||
>>= relativizeUrls
|
>>= 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
|
match "templates/*" $ compile templateCompiler
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
<!-- Begin Hakyll template, post-grid.html -->
|
<!-- Begin Hakyll template, post-grid.html -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
$for(works)$
|
$for(works)$
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
|
<h3>$title$</h3>
|
||||||
<img src="$img$" class="img-responsive"/>
|
<img src="$img$" class="img-responsive"/>
|
||||||
<!-- N.B. use img-fluid for Bootstrap 4 -->
|
<!-- N.B. use img-fluid for Bootstrap 4 -->
|
||||||
<a href="$url$">$title$</a> - $date$
|
<a href="$url$">$date$</a>
|
||||||
|
$body$
|
||||||
</div>
|
</div>
|
||||||
$endfor$
|
$endfor$
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user