diff --git a/css/default.css b/css/default.css index 24f4227..83cfdc8 100644 --- a/css/default.css +++ b/css/default.css @@ -264,6 +264,20 @@ ul { list-style-type: square; padding-left: 2em; } +.notes-list { + list-style: none; + padding-left: 0; + margin-left: 0; +} +.notes-list li { + position: relative; + padding-left: 1em; +} +.notes-list li::before { + content: "-"; + position: absolute; + left: 0; +} li { margin-bottom: 0.15em; } @@ -404,6 +418,12 @@ code { margin-left: 0 } + div#contents ul.notes-list, + div#contents-big ul.notes-list { + list-style: none; + padding-left: 0; + } + div#contents-big ul ul { list-style-type: none; } diff --git a/src/site.hs b/src/site.hs index 38b68fa..214b994 100644 --- a/src/site.hs +++ b/src/site.hs @@ -26,6 +26,11 @@ cleanIndexHtmls = return . fmap (replaceAll pattern replacement) pattern :: String = "/index.html" replacement :: String -> String = const "/" +loadNoteLinks :: Compiler [Item String] +loadNoteLinks = do + noteIds <- sortOn toFilePath <$> getMatches "notes/*" + pure [Item noteId "" | noteId <- noteIds] + -------------------------------------------------------------------------------- config :: Configuration @@ -103,7 +108,8 @@ main = hakyllWith config $ do match "notes/*" $ do route cleanRoute compile $ do - tocCtx <- getTocCtx defaultContext + notes <- loadNoteLinks + tocCtx <- getTocCtx $ listField "notes" defaultContext (return notes) <> defaultContext chaoDocCompiler >>= loadAndApplyTemplate "templates/note.html" tocCtx >>= relativizeUrls @@ -111,9 +117,9 @@ main = hakyllWith config $ do create ["index.html"] $ do route idRoute compile $ do - notes <- sortOn (toFilePath . itemIdentifier) <$> loadAll "notes/*" + notes <- loadNoteLinks let notesCtx = - listField "posts" defaultContext (return notes) + listField "notes" defaultContext (return notes) `mappend` constField "title" "Notes" `mappend` defaultContext makeItem "" diff --git a/templates/note.html b/templates/note.html index 0bc9a6f..7fb5ed0 100644 --- a/templates/note.html +++ b/templates/note.html @@ -11,6 +11,7 @@ $partial("templates/head.html")$ that are big enough -->
@@ -38,4 +39,4 @@ $partial("templates/head.html")$