Added redirects for other list services

This commit is contained in:
2018-04-04 16:45:02 +02:00
parent 74daef0df7
commit 534372de24
8 changed files with 53 additions and 38 deletions

19
utils/SmartRedirect.go Normal file
View File

@ -0,0 +1,19 @@
package utils
import (
"strings"
"github.com/aerogo/aero"
)
// SmartRedirect automatically adds the /_ prefix to the URI if required.
func SmartRedirect(ctx *aero.Context, uri string) string {
// Redirect
prefix := ""
if strings.HasPrefix(ctx.URI(), "/_") {
prefix = "/_"
}
return ctx.Redirect(prefix + uri)
}