From dda65d11164c9f0045673bf43422d5b26032401c Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 20 Jun 2023 19:25:03 +0200 Subject: [PATCH] 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 to the `md` file. This is both a nuisance and a feature. --- app/Main.hs | 10 +++++++--- ...21-building-my-new-website-goals-and-dreams.md | 2 ++ posts/2022-10-27-my-note-taking-setup.md | 2 ++ src/Kit/Templates/Index.hs | 15 ++++++--------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 638eb8e..8ca2409 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -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 diff --git a/posts/2022-09-21-building-my-new-website-goals-and-dreams.md b/posts/2022-09-21-building-my-new-website-goals-and-dreams.md index e6507a2..bbacf31 100644 --- a/posts/2022-09-21-building-my-new-website-goals-and-dreams.md +++ b/posts/2022-09-21-building-my-new-website-goals-and-dreams.md @@ -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 + ## A lightweight static site diff --git a/posts/2022-10-27-my-note-taking-setup.md b/posts/2022-10-27-my-note-taking-setup.md index f7fe11f..5bf33b9 100644 --- a/posts/2022-10-27-my-note-taking-setup.md +++ b/posts/2022-10-27-my-note-taking-setup.md @@ -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. + 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. diff --git a/src/Kit/Templates/Index.hs b/src/Kit/Templates/Index.hs index f04fb88..c1431ca 100644 --- a/src/Kit/Templates/Index.hs +++ b/src/Kit/Templates/Index.hs @@ -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