Projects page

This commit is contained in:
Mats Rauhala 2021-01-25 21:11:14 +02:00
parent 7056ca822c
commit a49af625bf
7 changed files with 88 additions and 15 deletions

View File

@ -109,6 +109,12 @@ article .header {
} }
} }
.projectlist {
display: flex;
align-items: center;
justify-content: space-between;
}
@media (min-width: 640px) { @media (min-width: 640px) {
body { body {
width: 60rem; width: 60rem;

View File

@ -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
```

View File

@ -18,6 +18,7 @@
<!-- Logo by Jason Long --> <!-- Logo by Jason Long -->
<a href="/">Home</a> <a href="/">Home</a>
<a href="/posts.html">Posts</a> <a href="/posts.html">Posts</a>
<a href="/projects.html">Projects</a>
<a href="https://git.rauhala.info"><img src="/images/git_16.png" alt="git" /></a> <a href="https://git.rauhala.info"><img src="/images/git_16.png" alt="git" /></a>
<a href="/contact.html">Contact</a> <a href="/contact.html">Contact</a>
</nav> </nav>

View File

@ -1,5 +1,5 @@
<ul> <ul>
$for(posts)$ $for(items)$
<li> <li>
<a href="$url$">$title$</a> - $date$ <a href="$url$">$title$</a> - $date$
</li> </li>

View File

@ -0,0 +1,8 @@
<ul>
$for(items)$
<li>
<div class="projectlist"><a href="$url$">$title$</a>$if(badge)$<img src="$badge$" />$endif$</div>
</li>
$endfor$
</ul>

View File

@ -0,0 +1,6 @@
<article>
<section>
$body$
</section>
</article>

View File

@ -1,5 +1,6 @@
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
import Hakyll import Hakyll
import Data.List import Data.List
@ -39,6 +40,13 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
>>= loadAndApplyTemplate "templates/default.html" defaultContext >>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls >>= 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 match (fromList ["index.markdown", "contact.markdown"]) $ do
route $ setExtension "html" route $ setExtension "html"
@ -46,23 +54,23 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
>>= loadAndApplyTemplate "templates/default.html" defaultContext >>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls >>= relativizeUrls
create ["posts.html"] $ do archive $ Archive { output = "posts.html"
route idRoute , input = "posts/*"
compile $ do , title = "Posts"
let postsContext = , template = "templates/post-list.html"
listField "posts" postContext posts , context = postContext
<> constField "title" "Posts" }
<> defaultContext
posts = recentFirst =<< loadAll "posts/*"
makeItem ""
>>= loadAndApplyTemplate "templates/post-list.html" postsContext
>>= loadAndApplyTemplate "templates/default.html" postsContext
>>= relativizeUrls
archive $ Archive { output = "projects.html"
, input = "projects/*"
, title = "Projects"
, template = "templates/project-list.html"
, context = postContext
}
match "templates/*" $ compile templateBodyCompiler match "templates/*" $ compile templateBodyCompiler
where where
postContext :: Context String postContext :: Context String
postContext = dateField "date" "%B %e, %Y" <> defaultContext postContext = dateField "date" "%B %e, %Y" <> defaultContext
ignore :: FilePath -> Bool ignore :: FilePath -> Bool
@ -73,6 +81,27 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
, (".swp" `isSuffixOf`) , (".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 :: a -> [a] -> [a]
prepend = (:) prepend = (:)