Add: Redirect / to WikiHome
This commit is contained in:
parent
932f87204c
commit
edf05b8e7c
@ -10,22 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func WikiHome(c echo.Context) error {
|
func WikiHome(c echo.Context) error {
|
||||||
var err error
|
return c.Redirect(http.StatusMovedPermanently, "/WikiHome")
|
||||||
page, err := store.GetPage("WikiHome")
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err.Error())
|
|
||||||
err := store.AddPage("WikiHome", "This is the home of the wiki")
|
|
||||||
if err != nil {
|
|
||||||
log.Panicln(err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("res: %T\n", page)
|
|
||||||
unsafe := blackfriday.Run([]byte(page.Body))
|
|
||||||
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
|
|
||||||
return c.Render(http.StatusOK, "page.html", map[string]interface{}{
|
|
||||||
"page": page,
|
|
||||||
"html": string(html[:]),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func WikiPage(c echo.Context) error {
|
func WikiPage(c echo.Context) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user