mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-05-25 01:03:35 +00:00
Redirect root url to index
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
package renderer
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/content"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/templates"
|
||||
routing "github.com/jackwhelpton/fasthttp-routing/v2"
|
||||
)
|
||||
|
||||
// rootRedirect redirects the root url to the index using http redirect
|
||||
func (r *Renderer) rootRedirect(c *routing.Context) (err error) {
|
||||
|
||||
c.Redirect(templates.URLIndex, http.StatusFound)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// index handler renders index data
|
||||
func (r *Renderer) index(c *routing.Context) (err error) {
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ func (r *Renderer) init() {
|
||||
router.NotFound(r.errorNotFound)
|
||||
|
||||
root := router.Group(r.Base)
|
||||
root.Get(templates.URLRoot, r.rootRedirect)
|
||||
root.Get(templates.URLIndex, r.index)
|
||||
root.Get(templates.URLBlog, r.blog)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user