Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move favicon.ico, robots.txt from config to static.

Added static_path to GititConfig.
  • Loading branch information...
commit 140e52838036556d63adf053df81f58f7a6062b5 1 parent 903fb68
John MacFarlane authored
14 Network/Gitit2.hs
View
@@ -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)
@@ -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
@@ -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
@@ -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
2  config/settings.yaml
View
@@ -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
5 gitit2.cabal
View
@@ -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
@@ -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
1  src/gitit2.hs
View
@@ -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
0  config/favicon.ico → static/favicon.ico
View
File renamed without changes
0  config/robots.txt → static/robots.txt
View
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.