Skip to content

Commit

Permalink
Move favicon.ico, robots.txt from config to static.
Browse files Browse the repository at this point in the history
Added static_path to GititConfig.
  • Loading branch information
John MacFarlane committed Mar 16, 2013
1 parent 903fb68 commit 140e528
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions Network/Gitit2.hs
Expand Up @@ -60,7 +60,6 @@ import Control.Exception (throw, handle, try)
import Text.Highlighting.Kate
import Data.Time (getCurrentTime, addUTCTime)
import Yesod.AtomFeed
import Yesod.Default.Handlers (getRobotsR, getFaviconR)
import Data.Yaml
import System.Directory
import System.Time (ClockTime (..), getClockTime)
Expand Down Expand Up @@ -115,6 +114,7 @@ data GititConfig = GititConfig{
, default_format :: PageFormat -- ^ Default format for wiki pages
, repository_path :: FilePath -- ^ Path to wiki
, page_extension :: FilePath -- ^ Extension for page files
, static_path :: FilePath -- ^ Path of static dir
, use_mathjax :: Bool -- ^ Link to mathjax script
, feed_days :: Integer -- ^ Days back for feed entries
, feed_minutes :: Integer -- ^ Minutes to cache feed before refresh
Expand Down Expand Up @@ -229,10 +229,10 @@ mkYesodSub "Gitit" [ ClassP ''HasGitit [VarT $ mkName "master"]
/ HomeR GET
/_help HelpR GET
/_static StaticR Static getStatic
/robots.txt GititRobotsR GET
/favicon.ico GititFaviconR GET
/_index IndexBaseR GET
/_index/*Page IndexR GET
/favicon.ico GititFaviconR GET
/robots.txt GititRobotsR GET
/_random RandomR GET
/_raw/*Page RawR GET
/_edit/*Page EditR GET
Expand Down Expand Up @@ -435,10 +435,14 @@ isSourceFile path' = do
-- allow svg to be served as image

getGititRobotsR :: GH m RepPlain
getGititRobotsR = getRobotsR
getGititRobotsR = do
conf <- getConfig
sendFile "text/plain" (static_path conf </> "robots.txt")

getGititFaviconR :: GH m ()
getGititFaviconR = getFaviconR
getGititFaviconR = do
conf <- getConfig
sendFile "image/x-icon" (static_path conf </> "favicon.ico")

getHomeR :: HasGitit master => GH master RepHtml
getHomeR = do
Expand Down
2 changes: 1 addition & 1 deletion config/settings.yaml
Expand Up @@ -4,7 +4,7 @@ repository_path: wikidata
repository_type: git
page_extension: .page
default_format: markdown
listen_address: 127.0.0.1
listen_address: 0.0.0.0
use_mathjax: true
feed_days: 14
use_cache: true
Expand Down
5 changes: 2 additions & 3 deletions gitit2.cabal
Expand Up @@ -16,8 +16,8 @@ homepage: http://gitit.net
data-files: README.markdown
messages/en.msg
config/settings.yaml
config/favicon.ico
config/robots.txt
static/favicon.ico
static/robots.txt
static/js/jquery-1.7.2.min.js
static/js/jquery-ui-1.8.21.custom.min.js
static/img/logo.png
Expand Down Expand Up @@ -59,7 +59,6 @@ library
-- , yesod-platform >= 1.1 && < 1.2
, yesod >= 1.1 && < 1.2
, yesod-static >= 1.1 && < 1.2
, yesod-default >= 1.1 && < 1.2
, yesod-core >= 1.1 && < 1.2
, yesod-form >= 1.1 && < 1.3
, yesod-test >= 0.3 && < 0.4
Expand Down
1 change: 1 addition & 0 deletions src/gitit2.hs
Expand Up @@ -218,6 +218,7 @@ main = do
, default_format = format
, repository_path = cfg_repository_path conf
, page_extension = cfg_page_extension conf
, static_path = cfg_static_dir conf
, use_mathjax = cfg_use_mathjax conf
, feed_days = cfg_feed_days conf
, feed_minutes = cfg_feed_minutes conf
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 140e528

Please sign in to comment.