Commits

Luke Plant committed 1a16389

Changes to the way the page title works, and started categories view

  • Participants
  • Parent commits f02c7aa

Comments (0)

Files changed (2)

File src/Blog/Templates.hs

     , pcontent :: t2
     }
 
-defaultPageVars = PageVars { ptitle = "All Unkept"
+defaultPageVars = PageVars { ptitle = ""
                            , pcontent = ""
                            }
 
 -- Complete page template
 page vars =
-    header
-    << (meta ! [httpequiv "Content-Type",
-                content "text/html; charset=utf-8"]
-        +++ thelink ! [rel "alternate",
-                       thetype "application/rss+xml",
-                       title "RSS",
-                       href "/TODO"] << ""
-        +++ thelink ! [rel "StyleSheet",
-                       href "/newblog.css",
-                       thetype "text/css"] << ""
-        +++ thelink ! [rel "shortcut icon",
-                       href "/favicon.ico",
-                       thetype "image/x-icon"] << ""
-        +++ (thetitle << ptitle vars)
-       )
+    (header
+     << (meta ! [httpequiv "Content-Type",
+                 content "text/html; charset=utf-8"]
+         +++ thelink ! [rel "alternate",
+                        thetype "application/rss+xml",
+                        title "RSS",
+                        href "/TODO"] << ""
+         +++ thelink ! [rel "StyleSheet",
+                        href "/newblog.css",
+                        thetype "text/css"] << ""
+         +++ thelink ! [rel "shortcut icon",
+                        href "/favicon.ico",
+                        thetype "image/x-icon"] << ""
+         +++ thetitle << fulltitle
+        ))
     +++
     body
     << thediv ! [identifier "container"]
                (thediv ! [identifier "content"]
                            << pcontent vars)
               )
+    where fulltitle = let pt = ptitle vars
+                      in if null pt
+                         then "All Unkept"
+                         else pt ++ " « All Unkept"
 
 
 -- Page specific templates
                 { pcontent = h1 << "This is the title"
                              +++
                              p << "This is a test"
+                , ptitle = "This is the title"
                 }
+
+categoriesPage = page $ defaultPageVars
+                 { pcontent = h1 << "Categories"
+                              +++
+                              p << "TODO"
+                 , ptitle = "Categories"
+                 }

File src/Blog/Views.hs

 
 dummyView req = return $ Just $ standardResponse ("TODO" :: String) :: IO (Maybe Response)
 
-categoriesView = dummyView
+categoriesView req = return $ Just $ standardResponse categoriesPage :: IO (Maybe Response)
 categoryView slug = dummyView
 postView slug = dummyView