diff --git a/default.nix b/default.nix index 70a1dd6..421bdc9 100644 --- a/default.nix +++ b/default.nix @@ -1,11 +1,11 @@ -{ mkDerivation, base, filepath, hakyll, stdenv }: +{ mkDerivation, base, filepath, hakyll, hakyll-favicon, stdenv }: mkDerivation { pname = "rf"; version = "0.1.1.1"; src = ./.; isLibrary = false; isExecutable = true; - executableHaskellDepends = [ base filepath hakyll ]; + executableHaskellDepends = [ base filepath hakyll hakyll-favicon ]; homepage = "regularflolloping.com"; description = "tA's blog"; license = stdenv.lib.licenses.bsd3; diff --git a/icons/favicon.svg b/icons/favicon.svg new file mode 100644 index 0000000..b9d441e --- /dev/null +++ b/icons/favicon.svg @@ -0,0 +1,87 @@ + + + + + + + + + + image/svg+xml + + + + + + + + @ + + diff --git a/rf.cabal b/rf.cabal index dacebfd..8000f97 100644 --- a/rf.cabal +++ b/rf.cabal @@ -23,5 +23,6 @@ executable site build-depends: base , hakyll , filepath + , hakyll-favicon -- hs-source-dirs: default-language: Haskell2010 diff --git a/site.hs b/site.hs index 78c4695..c12ed49 100644 --- a/site.hs +++ b/site.hs @@ -1,15 +1,17 @@ {-# LANGUAGE OverloadedStrings #-} -import Hakyll import Data.Monoid ((<>)) import Data.List (sortBy,isSuffixOf) -import System.FilePath.Posix (takeBaseName,takeDirectory,()) import GHC.IO.Encoding +import Hakyll +import Hakyll.Favicon (faviconsRules, faviconsField) +import System.FilePath.Posix (takeBaseName,takeDirectory,()) main :: IO () main = do setLocaleEncoding utf8 hakyll $ do + faviconsRules "icons/favicon.svg" match "humans.txt" $ do route idRoute compile copyFileCompiler @@ -57,8 +59,7 @@ main = do compile $ do posts <- recentFirst =<< loadAll "posts/*" let indexCtx = - listField "posts" postCtx (return posts) <> - defaultContext + listField "posts" postCtx (return posts) <> ctx getResourceBody >>= applyAsTemplate indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx @@ -69,7 +70,8 @@ main = do match "templates/*" $ compile templateBodyCompiler ctx :: Context String -ctx = defaultContext +ctx = defaultContext <> + faviconsField postCtx :: Context String postCtx = diff --git a/templates/default.html b/templates/default.html index ad6ded3..8d37f78 100644 --- a/templates/default.html +++ b/templates/default.html @@ -6,6 +6,7 @@ rf - $title$ + $favicons$