36 lines
1.1 KiB
Haskell
36 lines
1.1 KiB
Haskell
{-# LANGUAGE NoImplicitPrelude #-}
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
{-# LANGUAGE TypeFamilies #-}
|
|
-- | Common handler functions.
|
|
module Handler.Common where
|
|
|
|
import Data.FileEmbed (embedFile)
|
|
import Yesod.Sitemap
|
|
|
|
import Import
|
|
|
|
-- These handlers embed files in the executable at compile time to avoid a
|
|
-- runtime dependency, and for efficiency.
|
|
|
|
getFaviconR :: Handler TypedContent
|
|
getFaviconR = do cacheSeconds $ 60 * 60 * 24 * 30 -- cache for a month
|
|
return $ TypedContent "image/x-icon"
|
|
$ toContent $(embedFile "config/favicon.ico")
|
|
|
|
getKeybaseR :: Handler TypedContent
|
|
getKeybaseR = return $ TypedContent typePlain
|
|
$ toContent $(embedFile "config/keybase.txt")
|
|
|
|
getRobotsR :: Handler Text
|
|
getRobotsR = robots SitemapR
|
|
|
|
getSitemapR :: Handler TypedContent
|
|
getSitemapR = sitemap $ do
|
|
yield SitemapUrl
|
|
{ sitemapLoc = HomeR
|
|
, sitemapLastMod = Nothing
|
|
, sitemapChangeFreq = Just Daily
|
|
, sitemapPriority = Nothing
|
|
}
|