about summary refs log tree commit diff
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 769e2180a3aa..d84e1d5332d0 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -40,6 +40,7 @@ tazBlog = do
          , do dir " " $ nullDir
               seeOther ("https://plus.google.com/115916629925754851590" :: String) (toResponse ())
          , path $ \(id_ :: Int) -> getEntryLink id_
+         , path $ \(year :: Int) -> path $ \(month :: Int) -> path $ \(id_ :: String) -> formatOldLink year month id_
          , dir "res" $ serveDirectory DisableBrowsing [] "../res"
          , dir "notice" $ ok $ toResponse showSiteNotice
          , serveDirectory DisableBrowsing [] "../res"
@@ -57,6 +58,11 @@ blogHandler lang =
               showIndex lang
          ]
 
+formatOldLink :: Int -> Int -> String -> ServerPart Response
+formatOldLink y m id_ = 
+  flip seeOther (toResponse ()) $ 
+    concat $ intersperse' "/"  ["de", show y, show m, replace '.' '/' id_]
+
 showEntry :: BlogLang -> String -> ServerPart Response
 showEntry lang id_ = do
     entryJS <- liftIO $ runCouchDB' $ getDoc (db "tazblog") (doc id_)