dailies: init
All checks were successful
ci/woodpecker/push/ci Pipeline was successful

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-10-29 11:15:35 +05:30
parent 84764567af
commit 5a7ce358d4
4 changed files with 45 additions and 1 deletions

View File

@@ -2,7 +2,6 @@
title: Home title: Home
home: true home: true
--- ---
<h2>Welcome</h2> <h2>Welcome</h2>
$partial("templates/post-preview-list.html")$ $partial("templates/post-preview-list.html")$
<p>Find more in the <a href="/archive.html">archives</a>.</p> <p>Find more in the <a href="/archive.html">archives</a>.</p>

View File

@@ -80,6 +80,31 @@ main = hakyllWith config $ do
>>= loadAndApplyTemplate "templates/default.html" archiveCtx >>= loadAndApplyTemplate "templates/default.html" archiveCtx
>>= relativizeUrls >>= relativizeUrls
match "dailies/*org" $ do
route $ setExtension "html"
compile $ do
pandocCompiler
>>= saveSnapshot "dailiescontent"
>>= loadAndApplyTemplate "templates/post.html" dailiesCtx
>>= loadAndApplyTemplate "templates/default.html" dailiesCtx
>>= relativizeUrls
create ["dailies.html"] $ do
route idRoute
compile $ do
dailyToday <- fmap (take 1) . recentFirst =<< loadAllSnapshots "dailies/*" "dailiescontent"
dailies <- recentFirst =<< loadAll "dailies/*"
let dailiesCtx' =
listField "today" dailiesCtx (return dailyToday)
<> listField "posts" dailiesCtx (return dailies)
<> constField "title" "Dailies"
<> defaultCtx
makeItem ""
>>= loadAndApplyTemplate "templates/dailies.html" dailiesCtx'
>>= loadAndApplyTemplate "templates/default.html" dailiesCtx'
>>= relativizeUrls
match "index.html" $ do match "index.html" $ do
route idRoute route idRoute
compile $ do compile $ do
@@ -144,6 +169,11 @@ postCtx tags =
<> teaserField "teaser" "content" <> teaserField "teaser" "content"
<> defaultCtx <> defaultCtx
dailiesCtx :: Context String
dailiesCtx =
dateField "date" "%B %e, %Y"
<> defaultCtx
defaultCtx :: Context String defaultCtx :: Context String
defaultCtx = defaultCtx =
listField "subdomains" subCtx (return subdomains) listField "subdomains" subCtx (return subdomains)

14
templates/dailies.html Normal file
View File

@@ -0,0 +1,14 @@
$for(today)$
<article>
<h1 class="post-title">$title$</h1>
<div class="post-teaser">
$body$
</div>
<hr>
</article>
$endfor$
<p>
<h3> Previous Dailies: </h3>
</p>
$partial("templates/post-list.html")$

View File

@@ -17,6 +17,7 @@
<a href="/about.html">About</a> <a href="/about.html">About</a>
<a href="/contact.html">Contact</a> <a href="/contact.html">Contact</a>
<a href="/archive.html">Archive</a> <a href="/archive.html">Archive</a>
<a href="/dailies.html">Dailies</a>
<a href="/links.html">Links</a> <a href="/links.html">Links</a>
</nav> </nav>
</header> </header>