Skip to content

Commit

Permalink
Fix URL mapping for top level blog posts
Browse files Browse the repository at this point in the history
If a blog post is found directly below the content folder, the
resulting URL contains a double slash.
Example: "content/mypost.md" gets mapped to "baseURL//mypost".
This commit fixes that behaviour.

Also removed left-over comments from previous commit.
  • Loading branch information
menelaos committed May 23, 2014
1 parent 33f9770 commit b88b4c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/Snap/StaticPages/Internal/Handlers.hs
Expand Up @@ -221,10 +221,6 @@ serveIndex soFar content = do
let recent = take 5 rchron

let runPosts = loopThru st
-- let splices1 = [ ("posts:alphabetical" , runPosts alpha)
-- , ("posts:chronological" , runPosts chron)
-- , ("posts:reverseChronological", runPosts rchron)
-- , ("posts:recent" , runPosts recent) ]
let splices1 = do
"posts:alphabetical" ## runPosts alpha
"posts:chronological" ## runPosts chron
Expand Down
4 changes: 3 additions & 1 deletion src/Snap/StaticPages/Internal/Post.hs
Expand Up @@ -308,7 +308,9 @@ buildContentMap baseURL basedir = build [] "."
if ".md" `isSuffixOf` f then do
-- it's a post
let baseName = dropExtension f
let pId = concat [baseURL, "/", pathSoFar, "/", baseName]
let pId = if null pathSoFar
then concat [baseURL, "/", baseName]
else concat [baseURL, "/", pathSoFar, "/", baseName]
!p <- readPost pId fp
return $! Map.insert (B.pack baseName) (ContentPost p) mp
else
Expand Down

0 comments on commit b88b4c7

Please sign in to comment.