breezewiki/src/page-redirect-wiki-home.rkt

18 lines
514 B
Racket
Raw Normal View History

2022-09-09 03:42:20 +00:00
#lang racket/base
(require net/url
web-server/http
"application-globals.rkt"
2022-10-09 09:54:59 +00:00
"data.rkt"
"../lib/url-utils.rkt"
"../lib/xexpr-utils.rkt")
2022-09-09 03:42:20 +00:00
(provide
redirect-wiki-home)
(define (redirect-wiki-home req)
(response-handler
(define wikiname (path/param-path (car (url-path (request-uri req)))))
2022-10-09 09:54:59 +00:00
(define siteinfo (siteinfo-fetch wikiname))
(define dest (format "/~a/wiki/~a" wikiname (or (siteinfo^-basepage siteinfo) "Main_Page")))
2022-09-09 03:42:20 +00:00
(generate-redirect dest)))