no idea how metadata will work
This commit is contained in:
parent
6369d23683
commit
62c5a5abb8
1 changed files with 17 additions and 3 deletions
20
Site.hs
20
Site.hs
|
@ -46,8 +46,8 @@ main = Shake.shakeArgs Shake.shakeOptions $ do
|
||||||
outputDir :: String
|
outputDir :: String
|
||||||
outputDir = "publish"
|
outputDir = "publish"
|
||||||
|
|
||||||
buildTargets :: Action ()
|
buildSite :: Action ()
|
||||||
buildTargets = do
|
buildSite = do
|
||||||
-- static files
|
-- static files
|
||||||
assetPaths <- Shake.getDirectoryFiles "" assetGlobs
|
assetPaths <- Shake.getDirectoryFiles "" assetGlobs
|
||||||
-- path concat each asset path so it's output into the outputDir
|
-- path concat each asset path so it's output into the outputDir
|
||||||
|
@ -59,7 +59,17 @@ buildTargets = do
|
||||||
-- handle posts
|
-- handle posts
|
||||||
postPaths <- Shake.getDirectoryFiles "" postGlobs
|
postPaths <- Shake.getDirectoryFiles "" postGlobs
|
||||||
Shake.need $ map indexHtmlOutputPath postPaths
|
Shake.need $ map indexHtmlOutputPath postPaths
|
||||||
|
|
||||||
|
-- remaining pages, index.xml = rss feed
|
||||||
|
Shake.need $ map (outputDir </>) ["index.html", "index.xml"]
|
||||||
|
|
||||||
|
-- make a rule of the pattern outputDir/asset_name which copes from outputDir/../pages
|
||||||
|
assets :: Rules ()
|
||||||
|
assets = map (outputDir </>) assetGlobs |%> \target -> do
|
||||||
|
let src = Shake.dropDirectory1 target </> "pages"
|
||||||
|
Shake.copyFileChanged src target
|
||||||
|
Shake.putInfo $ "Copied " <> target <> " from " <> src
|
||||||
|
|
||||||
typstToHtml :: FilePath -> Action Text
|
typstToHtml :: FilePath -> Action Text
|
||||||
typstToHtml filePath = do
|
typstToHtml filePath = do
|
||||||
content <- Shake.readFile' filePath
|
content <- Shake.readFile' filePath
|
||||||
|
@ -73,6 +83,10 @@ typstToHtml filePath = do
|
||||||
writerOptions =
|
writerOptions =
|
||||||
Pandoc.def {Pandoc.writerExtensions = Pandoc.pandocExtensions}
|
Pandoc.def {Pandoc.writerExtensions = Pandoc.pandocExtensions}
|
||||||
|
|
||||||
|
data Page = Page {pageTitle :: Text, pageContent :: Text}
|
||||||
|
deriving (Show, Generic)
|
||||||
|
deriving (ToJSON) via PrefixedSnake "page" Page
|
||||||
|
|
||||||
assetGlobs :: [String]
|
assetGlobs :: [String]
|
||||||
assetGlobs = ["static/*"]
|
assetGlobs = ["static/*"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue