diff --git a/handlers.go b/handlers.go index 116a264..77e0327 100755 --- a/handlers.go +++ b/handlers.go @@ -121,8 +121,6 @@ func generateSiteMap() (sitemap string) { } names = names[:i] lastEdited = lastEdited[:i] - fmt.Println(names) - sitemap = ` ` for i := range names { @@ -140,17 +138,16 @@ func generateSiteMap() (sitemap string) { } func handlePageRequest(c *gin.Context) { page := c.Param("page") + command := c.Param("command") + if page == "sitemap.xml" { c.Data(http.StatusOK, contentType("sitemap.xml"), []byte(generateSiteMap())) return - } - command := c.Param("command") - if len(command) < 2 { - c.Redirect(302, "/"+page+"/edit") + } else if page == "favicon.ico" { + data, _ := Asset("/static/img/cowyo/favicon.ico") + c.Data(http.StatusOK, contentType("/static/img/cowyo/favicon.ico"), data) return - } - // Serve static content from memory - if page == "static" { + } else if page == "static" { filename := page + command data, err := Asset(filename) if err != nil { @@ -159,6 +156,10 @@ func handlePageRequest(c *gin.Context) { c.Data(http.StatusOK, contentType(filename), data) return } + if len(command) < 2 { + c.Redirect(302, "/"+page+"/edit") + return + } version := c.DefaultQuery("version", "ajksldfjl") p := Open(page) diff --git a/templates/index.tmpl b/templates/index.tmpl index 84a34fe..d2ada86 100755 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -407,7 +407,7 @@ body#pad textarea { $("#publishPage").click(function(e) { e.preventDefault(); - var message = " This will add your page to the sitemap.xml so it will be indexed."; + var message = " This will add your page to the sitemap.xml so it will be indexed by search engines."; if ($('#publishPage').text() == "Unpublish") { message = ""; } @@ -553,8 +553,7 @@ body#pad textarea {
- {{ if .EditPage }}
{{ end }} + {{ if .EditPage }}
{{ end }}
{{ if .DontKnowPage }}
{{ .Route }} not understood!
{{ end }} {{ if .ViewPage }}{{ .RenderedPage }}