diff options
author | cel 🌸 <cel@blos.sm> | 2024-07-16 13:12:33 +0100 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2024-07-16 13:12:33 +0100 |
commit | fd0ea710395904e1b4cf5f22fd17af13db43ce5f (patch) | |
tree | c694efa675d3ad1daab3b1d9cfea737a805f1977 /site.hs | |
parent | e5e763f1d7d473b22d8c2e7f4a0058ada7832c24 (diff) | |
download | infoculture.pub-fd0ea710395904e1b4cf5f22fd17af13db43ce5f.tar.gz infoculture.pub-fd0ea710395904e1b4cf5f22fd17af13db43ce5f.tar.bz2 infoculture.pub-fd0ea710395904e1b4cf5f22fd17af13db43ce5f.zip |
webtorrent and teaser support
Diffstat (limited to '')
-rw-r--r-- | site.hs | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} import Data.Monoid (mappend) -import System.FilePath ((</>), (<.>), splitExtension, splitFileName, takeDirectory) +import System.FilePath ((</>), (<.>), splitExtension, splitFileName, takeDirectory, stripExtension, takeFileName, takeBaseName) import Hakyll @@ -20,6 +20,13 @@ main = hakyll $ do route idRoute compile copyFileCompiler + match "scripts/*" $ do + route idRoute + compile copyFileCompiler + + match "sw.min.js" $ do + route idRoute + compile copyFileCompiler match "style.css" $ do route idRoute @@ -128,6 +135,8 @@ postCtx :: Context String postCtx = constField "root" root `mappend` dateField "date" "%Y-%m-%d" `mappend` + idFieldFromPath "id" `mappend` + teaserField "teaser" "article-text" `mappend` dropIndexHtml "url" `mappend` defaultContext @@ -138,6 +147,11 @@ appendIndex :: Routes appendIndex = customRoute $ (\(p, e) -> p </> "index" <.> e) . splitExtension . toFilePath + +idFieldFromPath :: String -> Context a +idFieldFromPath key = mapContext transform (pathField key) where + transform path = takeBaseName path + dropIndexHtml :: String -> Context a dropIndexHtml key = mapContext transform (urlField key) where transform url = case splitFileName url of |