Commits

Luke Plant committed d8c16e6

Added view that redirects from 'posts/'

Comments (0)

Files changed (2)

src/Blog/Routes.hs

 
 indexRoute         = empty
 postRoute          = "posts/" <+/> stringParam
+postsRedirect      = "posts/" <+/> empty
 categoriesRoute    = "categories/" <+/> empty
 categoryRoute      = "categories/" <+/> stringParam
 debugRoute         = "debug/" <+/> stringParam
 
 routes = [ indexRoute        //-> mainIndex
          , postRoute         //-> postView
+         , postsRedirect     //-> postsRedirectView
          , categoriesRoute   //-> categoriesView
          , categoryRoute     //-> categoryView
          , debugRoute        //-> debug

src/Blog/Views.hs

 import Web.Utils (addHtml)
 import Web.GenUtils (utf8)
 import Blog.Templates
+import Blog.Links
 
 standardResponse html = buildResponse [
                          addHtml html
                  , addContent $ utf8 $ show req
                  ] utf8TextResponse
 
+postsRedirectView req = return $ Just $ redirectResponse indexLink :: IO (Maybe Response)
 
 -- TODO
 
 categoriesView = dummyView
 categoryView slug = dummyView
 postView slug = dummyView
+