diff --git a/rauhala.info/css/default.css b/rauhala.info/css/default.css
index 381ff73..d4c370d 100644
--- a/rauhala.info/css/default.css
+++ b/rauhala.info/css/default.css
@@ -109,6 +109,12 @@ article .header {
}
}
+.projectlist {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
@media (min-width: 640px) {
body {
width: 60rem;
diff --git a/rauhala.info/projects/2021-01-21-phrase.md b/rauhala.info/projects/2021-01-21-phrase.md
new file mode 100644
index 0000000..75862a7
--- /dev/null
+++ b/rauhala.info/projects/2021-01-21-phrase.md
@@ -0,0 +1,23 @@
+---
+title: phrase
+github: https://github.com/MasseR/phrase
+issues: https://github.com/MasseR/phrase/issues
+badge: https://github.com/MasseR/phrase/workflows/Run nix build/badge.svg
+---
+
+This project is a command line tool for generating password phrases using the
+[diceware method](https://diceware.dmuth.org/). The passwords are stored in a
+folder structure that is compatible with the
+[pass](https://www.passwordstore.org/) password store manager.
+
+
+
+```
+$ phrase asd
+inlet area crux
+
+$ pass show asd
+inlet area crux
+
+$ file ~/.password-store/asd.gpg
+```
diff --git a/rauhala.info/templates/default.html b/rauhala.info/templates/default.html
index 182f42f..2827a42 100644
--- a/rauhala.info/templates/default.html
+++ b/rauhala.info/templates/default.html
@@ -18,6 +18,7 @@
Home
Posts
+ Projects
Contact
diff --git a/rauhala.info/templates/post-list.html b/rauhala.info/templates/post-list.html
index 71cf1b9..2853546 100644
--- a/rauhala.info/templates/post-list.html
+++ b/rauhala.info/templates/post-list.html
@@ -1,5 +1,5 @@
- $for(posts)$
+ $for(items)$
-
$title$ - $date$
diff --git a/rauhala.info/templates/project-list.html b/rauhala.info/templates/project-list.html
new file mode 100644
index 0000000..8d28aa6
--- /dev/null
+++ b/rauhala.info/templates/project-list.html
@@ -0,0 +1,8 @@
+
+ $for(items)$
+ -
+
+
+ $endfor$
+
+
diff --git a/rauhala.info/templates/project.html b/rauhala.info/templates/project.html
new file mode 100644
index 0000000..ea376f8
--- /dev/null
+++ b/rauhala.info/templates/project.html
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/site/app/site.hs b/site/app/site.hs
index ed62128..6f66d83 100644
--- a/site/app/site.hs
+++ b/site/app/site.hs
@@ -1,5 +1,6 @@
---------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE StrictData #-}
import Hakyll
import Data.List
@@ -39,6 +40,13 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
+ match "projects/*" $ do
+ route $ setExtension "html"
+ compile $ pandocCompiler
+ >>= loadAndApplyTemplate "templates/project.html" postContext
+ >>= loadAndApplyTemplate "templates/default.html" defaultContext
+ >>= relativizeUrls
+
match (fromList ["index.markdown", "contact.markdown"]) $ do
route $ setExtension "html"
@@ -46,23 +54,23 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
- create ["posts.html"] $ do
- route idRoute
- compile $ do
- let postsContext =
- listField "posts" postContext posts
- <> constField "title" "Posts"
- <> defaultContext
- posts = recentFirst =<< loadAll "posts/*"
- makeItem ""
- >>= loadAndApplyTemplate "templates/post-list.html" postsContext
- >>= loadAndApplyTemplate "templates/default.html" postsContext
- >>= relativizeUrls
-
+ archive $ Archive { output = "posts.html"
+ , input = "posts/*"
+ , title = "Posts"
+ , template = "templates/post-list.html"
+ , context = postContext
+ }
+ archive $ Archive { output = "projects.html"
+ , input = "projects/*"
+ , title = "Projects"
+ , template = "templates/project-list.html"
+ , context = postContext
+ }
match "templates/*" $ compile templateBodyCompiler
where
+
postContext :: Context String
postContext = dateField "date" "%B %e, %Y" <> defaultContext
ignore :: FilePath -> Bool
@@ -73,6 +81,27 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
, (".swp" `isSuffixOf`)
]
+data Archive
+ = Archive { output :: Identifier
+ , input :: Pattern
+ , title :: String
+ , template :: Identifier
+ , context :: Context String
+ }
+
+archive :: Archive -> Rules ()
+archive Archive{..} = create [output] $ do
+ route idRoute
+ compile $ do
+ let itemsContext =
+ listField "items" context items
+ <> constField "title" title
+ <> defaultContext
+ items = recentFirst =<< loadAll input
+ makeItem ""
+ >>= loadAndApplyTemplate template itemsContext
+ >>= loadAndApplyTemplate "templates/default.html" itemsContext
+ >>= relativizeUrls
prepend :: a -> [a] -> [a]
prepend = (:)