Set up posts again
This commit is contained in:
parent
7e290bee2f
commit
7056ca822c
@ -16,6 +16,8 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<!-- Git logo from https://git-scm.com/downloads/logos -->
|
<!-- Git logo from https://git-scm.com/downloads/logos -->
|
||||||
<!-- Logo by Jason Long -->
|
<!-- Logo by Jason Long -->
|
||||||
|
<a href="/">Home</a>
|
||||||
|
<a href="/posts.html">Posts</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>
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
A list of small and big guides.
|
|
||||||
|
|
||||||
$partial("templates/post-list.html")$
|
|
@ -1,7 +1,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
$for(posts)$
|
$for(posts)$
|
||||||
<li>
|
<li>
|
||||||
<a href="$url$">$title$</a> - $modified$
|
<a href="$url$">$title$</a> - $date$
|
||||||
</li>
|
</li>
|
||||||
$endfor$
|
$endfor$
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
<article>
|
<article>
|
||||||
<section class="header">
|
<section class="header">
|
||||||
Posted on $date$, modified on $modified$
|
Posted on $date$
|
||||||
$if(author)$
|
|
||||||
by $author$
|
|
||||||
$endif$
|
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
$body$
|
$body$
|
||||||
|
@ -32,16 +32,40 @@ main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
|
|||||||
route idRoute
|
route idRoute
|
||||||
compile compressCssCompiler
|
compile compressCssCompiler
|
||||||
|
|
||||||
|
match "posts/*" $ do
|
||||||
|
route $ setExtension "html"
|
||||||
|
compile $ pandocCompiler
|
||||||
|
>>= loadAndApplyTemplate "templates/post.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"
|
||||||
compile $ pandocCompiler
|
compile $ pandocCompiler
|
||||||
>>= loadAndApplyTemplate "templates/default.html" defaultContext
|
>>= loadAndApplyTemplate "templates/default.html" defaultContext
|
||||||
>>= relativizeUrls
|
>>= 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
match "templates/*" $ compile templateBodyCompiler
|
match "templates/*" $ compile templateBodyCompiler
|
||||||
where
|
where
|
||||||
|
postContext :: Context String
|
||||||
|
postContext = dateField "date" "%B %e, %Y" <> defaultContext
|
||||||
|
ignore :: FilePath -> Bool
|
||||||
ignore path = any ($ takeFileName path)
|
ignore path = any ($ takeFileName path)
|
||||||
[ ("." `isPrefixOf`)
|
[ ("." `isPrefixOf`)
|
||||||
, ("#" `isPrefixOf`)
|
, ("#" `isPrefixOf`)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{ mkDerivation, base, hakyll, stdenv, time }:
|
{ mkDerivation, base, filepath, hakyll, stdenv, time }:
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
pname = "site";
|
pname = "site";
|
||||||
version = "0.1.0.0";
|
version = "0.1.0.0";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
isLibrary = false;
|
isLibrary = false;
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
executableHaskellDepends = [ base hakyll time ];
|
executableHaskellDepends = [ base filepath hakyll time ];
|
||||||
license = stdenv.lib.licenses.bsd3;
|
license = stdenv.lib.licenses.bsd3;
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,6 @@ executable site
|
|||||||
build-depends: base == 4.*
|
build-depends: base == 4.*
|
||||||
, hakyll >= 4.10
|
, hakyll >= 4.10
|
||||||
, time
|
, time
|
||||||
|
, filepath
|
||||||
ghc-options: -threaded
|
ghc-options: -threaded
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
Loading…
Reference in New Issue
Block a user