Compare commits

...

6 Commits

Author SHA1 Message Date
6a3b4c5f88 Remove hakyll-blog.cabal and update .Proof CSS 2026-03-24 20:06:48 +08:00
720a19e24d Remove .notes-list custom styles 2026-03-24 20:01:35 +08:00
1789c75f18 Revert "Rename package to hakysidian; add CLI and assets"
This reverts commit 3d2c5a8852.
2026-03-24 19:58:26 +08:00
3d2c5a8852 Rename package to hakysidian; add CLI and assets 2026-03-24 18:59:06 +08:00
614de591ba Add notes list and integrate into templates
New partial templates/notes-list.html to render the notes list.
Add .notes-list CSS for styling and ensure contents areas use it.
Refactor site.hs: add loadNoteLinks and provide a "notes" listField
used by index and note pages.
2026-03-24 14:56:45 +08:00
71611b0641 Increase body line-height and add theorem padding 2026-03-23 14:54:09 +08:00
7 changed files with 29 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
.theorem-environment { .theorem-environment {
font-style: italic; font-style: italic;
margin-top: 1em; margin-top: 1em;
padding: 0.5em;
background-color: whitesmoke; background-color: whitesmoke;
} }
@@ -35,6 +36,7 @@
} }
.Proof { .Proof {
background: none;
font-style: normal; font-style: normal;
position: relative; position: relative;
} }

View File

@@ -28,7 +28,7 @@ body {
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
font-size: 1rem; font-size: 1rem;
line-height: 125%; line-height: 140%;
color: var(--color-text); color: var(--color-text);
background-color: var(--color-bg); background-color: var(--color-bg);
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
@@ -404,6 +404,12 @@ code {
margin-left: 0 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 { div#contents-big ul ul {
list-style-type: none; list-style-type: none;
} }

View File

@@ -1,4 +1,4 @@
name: hakyll-blog name: hakysidian
version: 0.1.0.0 version: 0.1.0.0
build-type: Simple build-type: Simple
cabal-version: >= 1.10 cabal-version: >= 1.10

View File

@@ -26,6 +26,11 @@ cleanIndexHtmls = return . fmap (replaceAll pattern replacement)
pattern :: String = "/index.html" pattern :: String = "/index.html"
replacement :: String -> String = const "/" replacement :: String -> String = const "/"
loadNoteLinks :: Compiler [Item String]
loadNoteLinks = do
noteIds <- sortOn toFilePath <$> getMatches "notes/*"
pure [Item noteId "" | noteId <- noteIds]
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
config :: Configuration config :: Configuration
@@ -103,7 +108,8 @@ main = hakyllWith config $ do
match "notes/*" $ do match "notes/*" $ do
route cleanRoute route cleanRoute
compile $ do compile $ do
tocCtx <- getTocCtx defaultContext notes <- loadNoteLinks
tocCtx <- getTocCtx $ listField "notes" defaultContext (return notes) <> defaultContext
chaoDocCompiler chaoDocCompiler
>>= loadAndApplyTemplate "templates/note.html" tocCtx >>= loadAndApplyTemplate "templates/note.html" tocCtx
>>= relativizeUrls >>= relativizeUrls
@@ -111,9 +117,9 @@ main = hakyllWith config $ do
create ["index.html"] $ do create ["index.html"] $ do
route idRoute route idRoute
compile $ do compile $ do
notes <- sortOn (toFilePath . itemIdentifier) <$> loadAll "notes/*" notes <- loadNoteLinks
let notesCtx = let notesCtx =
listField "posts" defaultContext (return notes) listField "notes" defaultContext (return notes)
`mappend` constField "title" "Notes" `mappend` constField "title" "Notes"
`mappend` defaultContext `mappend` defaultContext
makeItem "" makeItem ""

View File

@@ -11,6 +11,7 @@ $partial("templates/head.html")$
that are big enough --> that are big enough -->
<div id="contents-big"> <div id="contents-big">
<p class="mini-header">Notes <a id="up-arrow" href="/"></a></p> <p class="mini-header">Notes <a id="up-arrow" href="/"></a></p>
$partial("templates/notes-list.html")$
<p class="mini-header">Contents <a id="up-arrow" href="#"></a></p> <p class="mini-header">Contents <a id="up-arrow" href="#"></a></p>
$toc$ $toc$
</div> </div>
@@ -38,4 +39,4 @@ $partial("templates/head.html")$
</div> </div>
</body> </body>
</html> </html>

View File

@@ -0,0 +1,7 @@
<ul class="notes-list">
$for(notes)$
<li>
<a href="$url$">$title$</a>
</li>
$endfor$
</ul>

View File

@@ -1,8 +1,2 @@
<h1 class="pagetitle">$title$</h1> <h1 class="pagetitle">$title$</h1>
<ul> $partial("templates/notes-list.html")$
$for(posts)$
<li>
<a href="$url$">$title$</a>
</li>
$endfor$
</ul>