From ec3a4a4715700294206d6e78d8b38a57a7de7592 Mon Sep 17 00:00:00 2001 From: Carlos Sosa Date: Sat, 24 Aug 2019 20:47:26 -0700 Subject: Move to use src/ directory with the addition of Site modules - Added Content record with Lenses. - Added Rules based content compilers * This is all based on [[https://github.com/blaenk/blaenk.github.io/blob/source/src/Site/Compilers.hs]] --- src/Site/Compilers.hs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/Site/Compilers.hs (limited to 'src/Site/Compilers.hs') diff --git a/src/Site/Compilers.hs b/src/Site/Compilers.hs new file mode 100644 index 0000000..dbb943b --- /dev/null +++ b/src/Site/Compilers.hs @@ -0,0 +1,34 @@ +module Site.Compilers + ( gsocPosts + , posts + , articles + , recentPosts + , recentArticles + ) +where + +import Hakyll ( Compiler + , Item + , loadAll + , recentFirst + , Pattern + , fromGlob + ) + +loadAllRecentFirst :: String -> Compiler [Item String] +loadAllRecentFirst glob = recentFirst =<< loadAll (fromGlob glob) + +gsocPosts :: Compiler [Item String] +gsocPosts = loadAllRecentFirst "gsoc/*.org" + +posts :: Compiler [Item String] +posts = loadAllRecentFirst "log/*.org" + +articles :: Compiler [Item String] +articles = loadAll (fromGlob "article/**") + +recentPosts :: Compiler [Item String] +recentPosts = take 4 <$> posts + +recentArticles :: Compiler [Item String] +recentArticles = take 4 <$> articles -- cgit v1.3-2-g0d8e