From 54106ae23433ebb377951f265ee03c70a793506c Mon Sep 17 00:00:00 2001 From: Rostyslav Hnatyshyn Date: Wed, 6 Sep 2023 19:51:38 -0700 Subject: [PATCH] add photo gallery --- css/default.scss | 19 ++++++++++++++++++- gallery.html | 6 ++++++ site.hs | 22 ++++++++++++++++++++-- templates/default.html | 1 + templates/gallery.html | 4 ++++ templates/photo.html | 3 +++ 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 gallery.html create mode 100644 templates/gallery.html create mode 100644 templates/photo.html diff --git a/css/default.scss b/css/default.scss index 4c9a820..e84d692 100644 --- a/css/default.scss +++ b/css/default.scss @@ -122,7 +122,7 @@ article .header { @media (min-width: 640px) { body { - width: 66%; + width: 90%; margin: 0 auto; padding: 0; } @@ -169,3 +169,20 @@ code { font-family: "PressStart"; padding: .1rem .3rem .2rem; } + +.gallery { + display:flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + align-items: center; + gap: 5px; +} + +.photo { + flex-basis: 33%; +} +.photo > img { + width: 100%; + height: auto; +} diff --git a/gallery.html b/gallery.html new file mode 100644 index 0000000..174ccd8 --- /dev/null +++ b/gallery.html @@ -0,0 +1,6 @@ +--- +title: Photo Gallery +--- +

+These are some of my favorite photos I've taken over the course of several years. They were all taken on film, and with the exception of a few, they were completely developed by myself. I develop a negative and then scan it using an Epson scanner and then store them in my digital archive. I use an old Canon Rebel EOS, shooting entirely on manual mode. The color photos were mostly taken on cheap FUJI reels, while the black and white are ILFORD reels. +

diff --git a/site.hs b/site.hs index 173f997..303b806 100644 --- a/site.hs +++ b/site.hs @@ -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 -------------------------------------------------------------------------------- diff --git a/templates/default.html b/templates/default.html index b9046ed..ff38ae0 100644 --- a/templates/default.html +++ b/templates/default.html @@ -14,6 +14,7 @@ diff --git a/templates/gallery.html b/templates/gallery.html new file mode 100644 index 0000000..d9523aa --- /dev/null +++ b/templates/gallery.html @@ -0,0 +1,4 @@ +$body$ + diff --git a/templates/photo.html b/templates/photo.html new file mode 100644 index 0000000..1c934a1 --- /dev/null +++ b/templates/photo.html @@ -0,0 +1,3 @@ +
+ +