Blog cards added to the index as as for loop template.

Non limit on the number of posts yet (thinking of 12). Post teaser must
be hand implemented by adding the comment <!--more--> to the `md` file.
This is both a nuisance and a feature.
This commit is contained in:
Etienne Werly 2023-06-20 19:25:03 +02:00
parent af7a1da258
commit dda65d1116
4 changed files with 17 additions and 12 deletions

View file

@ -45,14 +45,18 @@ main = hakyll $ do
route $ setExtension "html"
compile
$ pandocCompiler
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "src/Kit/Templates/Post.hs" defaultContext
. fmap demoteHeaders
create ["index.html"] $ do
route idRoute
compile
$ makeItem ""
>>= loadAndApplyTemplate "src/Kit/Templates/Index.hs" defaultContext
compile $ do
pages <- recentFirst =<< loadAllSnapshots "posts/*.md" "content"
let ctx = listField "pages"
(defaultContext <> teaserField "teaser" "content")
(return pages)
makeItem "" >>= loadAndApplyTemplate "src/Kit/Templates/Index.hs" ctx
create [cssHash] $ do
route $ constRoute . tail . path $ DefaultStylesheet

View file

@ -1,6 +1,7 @@
---
title: 'Building my new website: goals and dreams'
description: 'A first post to describe what I want to achieve, and the how and why.'
date: 2022-09-21
updated: 2023-06-19
---
@ -18,6 +19,7 @@ It'd be a website that compiles some personal posts. It should be
* A photo gallery
* Music?
* A pattern guide / style guide
<!--more-->
## A lightweight static site

View file

@ -1,6 +1,7 @@
---
title: My note taking setup
description: This post presents the tools I use to take everyday notes
date: 2022-10-27
---
In this post I present the setup I use to keep notes of ideas, notions *etc*. It uses **vim** with a selected set of plugins, to achieve a minimalistic implementation of the [Zettelkasten](https://en.wikipedia.org/wiki/Zettelkasten) method.
@ -8,6 +9,7 @@ In this post I present the setup I use to keep notes of ideas, notions *etc*. It
# An overview of Zettelkasten
Behind this name lies a simple idea: instead of trying to classify notes in folders, or by tag and being limited by one particular classification, let the notes all live in a same large box and just be interested in the *metadata*: which notes link to which.
<!--more-->
This way of keeping notes seems to be quite popular right now, and I must say I liked the idea that a note could just be dumped in a folder with just a few links to other notion to make it have its importance. I really lightens the burden of starting the process of writing something as it does not have to be classified yet, but will just classify itself in the process.

View file

@ -17,20 +17,17 @@ import Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes as A
dummy :: PostProp
dummy = PostProp { postRoute = Blog
, postTitle = "Go see all the posts now!"
, postSummary = H.p "Aaaaaaall the poooooooosts"
, postDate = "2023-06-20"
dummy = PostProp { postRoute = Post "$url$"
, postTitle = "$title$"
, postSummary = "$teaser$"
, postDate = "$date$"
}
indexBody :: Component Html
indexBody =
profileHeader
<> (section' <*> mconcat
[ buttonWithText <*> pure "Click!"
, buttonLink Blog <*> pure "All posts"
, blogCard dummy
]
<> ( section'
<*> mconcat [pure "$for(pages)$", blogCard dummy, pure "$endfor$"]
)
indexTemplate :: Component Html