add photo gallery
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import Data.Monoid (mappend)
|
||||
import Hakyll
|
||||
import Hakyll.Web.Sass (sassCompiler)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
config :: Configuration
|
||||
config =
|
||||
@@ -14,8 +15,8 @@ config =
|
||||
main :: IO ()
|
||||
main = hakyllWith config $ do
|
||||
-- Static directories
|
||||
|
||||
match ("fonts/*" .||. "images/*" .||. "files/*") $ do
|
||||
|
||||
match ("fonts/*" .||. "images/*" .||. "files/*" .||. "film/*") $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
@@ -51,6 +52,23 @@ main = hakyllWith config $ do
|
||||
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "gallery.html" $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
film <- loadAll "film/*"
|
||||
filmH <- loadBody "templates/photo.html"
|
||||
|
||||
let imgCtx :: Context CopyFile
|
||||
imgCtx = urlField "url" <> missingField
|
||||
|
||||
art <- applyTemplateList filmH imgCtx film
|
||||
let galleryCtx = constField "art" art <> defaultContext
|
||||
|
||||
getResourceBody
|
||||
>>= loadAndApplyTemplate "templates/gallery.html" galleryCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" galleryCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "templates/*" $ compile templateBodyCompiler
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user