Browse Source

Fix post listings & add comments

Amélia Liao 3 years ago
parent
commit
3ac48903e7
2 changed files with 19 additions and 8 deletions
  1. +3
    -3
      site.hs
  2. +16
    -5
      templates/post.html

+ 3
- 3
site.hs View File

@ -196,7 +196,7 @@ main = (*>) (setEnv "AMC_LIBRARY_PATH" "/usr/lib/amuletml/lib/") $ hakyllWith co
create ["archive.html"] $ do
route idRoute
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
posts <- recentFirst =<< loadAll "pages/posts/*"
let archiveCtx =
listField "posts" postCtx (return posts) <>
constField "title" "Archives" <>
@ -209,7 +209,7 @@ main = (*>) (setEnv "AMC_LIBRARY_PATH" "/usr/lib/amuletml/lib/") $ hakyllWith co
match "pages/*.html" $ do
route $ gsubRoute "pages/" (const "")
compile $ do
posts <- fmap (take 5) . recentFirst =<< loadAll "posts/*"
posts <- fmap (take 5) . recentFirst =<< loadAll "pages/posts/*"
let indexCtx =
listField "posts" postCtx (return posts) <>
constField "title" "Home" <>
@ -241,7 +241,7 @@ main = (*>) (setEnv "AMC_LIBRARY_PATH" "/usr/lib/amuletml/lib/") $ hakyllWith co
route idRoute
compile $ do
let feedCtx = postCtx <> bodyField "description"
posts <- (take 10 <$>) . recentFirst =<< loadAllSnapshots "posts/*" "content"
posts <- (take 10 <$>) . recentFirst =<< loadAllSnapshots "pages/posts/*" "content"
renderRss rssfeed feedCtx posts
postCtx :: Context String


+ 16
- 5
templates/post.html View File

@ -1,10 +1,21 @@
<div class="info">
Posted on $date$
$if(author)$
by $author$
$endif$
Posted on $date$ <br />
Comment on this post <a href="#comments">here</a>
</div>
<article>
$body$
</article>
</article>
<hr />
<div id="comments">
<script src="https://utteranc.es/client.js"
repo="plt-hokusai/blag"
issue-term="og:title"
label="comment"
theme="github-light"
crossorigin="anonymous"
async>
</script>
</div>

Loading…
Cancel
Save