Skip to content

Instantly share code, notes, and snippets.

@samueltardieu
Created March 21, 2013 10:00
Show Gist options
  • Save samueltardieu/5211927 to your computer and use it in GitHub Desktop.
Save samueltardieu/5211927 to your computer and use it in GitHub Desktop.
shortenUrl :: String -> String
shortenUrl url = case splitFileName url of
(dir, "index.html") | isLocal dir -> dir
_ -> url
where isLocal uri = isPrefixOf rootUrl uri || not (isInfixOf "://" uri)
@samueltardieu
Copy link
Author

rootUrl is my own site URL, with the "http://" prefix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment