Module used for generating HTML redirect pages. This allows renaming pages to avoid breaking existing links without requiring server-side support for formal 301 Redirect error codes
This datatype can be used directly if you want a lower-level interface to
generate redirects. For example, if you want to redirect
bar.jpg, you can use:
create ["foo.html"] $ do route idRoute compile $ makeItem $ Redirect "bar.jpg"
|Eq Redirect Source #|
|Ord Redirect Source #|
|Show Redirect Source #|
|Binary Redirect Source #|
|Writable Redirect Source #|
This function exposes a higher-level interface compared to using the
Redirect type manually.
This creates, using a database mapping broken URLs to working ones, HTML files which will do HTML META tag redirect pages (since, as a static site, we can't use web-server-level 301 redirects, and using JS is gross).
This is useful for sending people using old URLs to renamed versions, dealing
with common typos etc, and will increase site traffic. Such broken URLs can
be found by looking at server logs or by using Google Webmaster Tools.
Broken URLs must be valid Haskell strings, non-URL-escaped valid POSIX
filenames, and relative links, since they will be defined in a
and during generation, written to disk with the filename corresponding to the
broken URLs. (Target URLs can be absolute or relative, but should be
URL-escaped.) So broken incoming links like http://www.gwern.net/foo/ which
should be http://www.gwern.net/foobar cannot be fixed (since you cannot
create a HTML file named
"foo/" on disk, as that would be a directory).
An example of a valid association list would be:
brokenLinks = [ ("projects.html", "http://github.com/gwern") , ("/Black-market archive", "Black-market%20archives") ]
In which case the functionality can then be used in
main with a line like:
version "redirects" $ createRedirects brokenLinks
version is recommended to separate these items from your other pages.
The on-disk files can then be uploaded with HTML mimetypes
(either explicitly by generating and uploading them separately, by
auto-detection of the filetype, or an upload tool defaulting to HTML
mimetype, such as calling
will redirect browsers and search engines going to the old/broken URLs.