Skip to content

Commit

Permalink
simple hakyll script
Browse files Browse the repository at this point in the history
  • Loading branch information
rejuvyesh committed Mar 10, 2014
1 parent c2668e8 commit c0460ad
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
25 changes: 25 additions & 0 deletions navya-website.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- Initial navya-website.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/

name: navya-website
version: 0.1.0.0
synopsis: Navya's website
-- description:
homepage: http://github.com/navya/navya-website
license: MIT
license-file: LICENSE
author: rejuvyesh
maintainer: [email protected]
-- copyright:
category: Web
build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10

executable navya-website
main-is: Main.hs
-- other-modules:
other-extensions: UnicodeSyntax, Arrows, OverloadedStrings
build-depends: base >=4.6 && <4.7, filepath >=1.3 && <1.4, pandoc >=1.12 && <1.13, hakyll
hs-source-dirs: src
default-language: Haskell2010
46 changes: 46 additions & 0 deletions src/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- File: Main.hs

{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Text.Pandoc as Pandoc

import Hakyll

main IO ()
main = hakyll$ do
match ("images/*" .||. "js/*" .||. "favicon.ico" .||. "fonts/*") $ do
route idRoute
compile copyFileCompiler

match "css/*" $ do
route idRoute
compile compressCssCompiler

match (fromList pages) $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
>>= removeIndexHtml

where
pages =
[ "about/index.md"
, "people/index.md"
, "services/index.md"
, "gallery/index.md"]

removeIndexHtml Item String Compiler (Item String)
removeIndexHtml item = return $ fmap (withUrls removeIndexStr) item
where
removeIndexStr String String
removeIndexStr str@(x:xs) | str == "/index.html" = ""
| otherwise = x:removeIndexStr xs
removeIndexStr [] = []



0 comments on commit c0460ad

Please sign in to comment.