From cbc14d7014621b44e78b200041fb4206572f348f Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 18 Mar 2016 08:39:41 -0400 Subject: [PATCH] Improved robots, added sitemap. Locking is simpler now and allows direct click to edit. Former-commit-id: 09ad353e7940058aad4e578949b2e4a58cb6a044 [formerly 52f9d99e471a7b490f6c0915a0d49593d6b51916] [formerly f0e82719115da8fd767cc99c8981c59094a69ca3 [formerly 9ec76efd339743fc2a2d4873efc3430508e88701]] Former-commit-id: e9bb713ba99798071e3f9376e790417d36d34c31 [formerly 69a662985ced356cc3f8657fa4b98117beec9f48] Former-commit-id: d1f51141039bc8656e8a9ae906a2389e7103081c --- routes.go | 6 +++++- static/text/robots.txt | 2 ++ static/text/sitemap.xml | 9 +++++++++ templates/view.tmpl | 2 +- utils.go | 3 --- 5 files changed, 17 insertions(+), 5 deletions(-) create mode 100755 static/text/sitemap.xml diff --git a/routes.go b/routes.go index 81f129a..d471c28 100644 --- a/routes.go +++ b/routes.go @@ -150,7 +150,11 @@ func editNote(c *gin.Context) { if title == "ws" { wshandler(c.Writer, c.Request) } else if title == "robots.txt" { - c.Data(200, "text/plain", []byte(robotsTxt)) + robotsTxtFile, _ := ioutil.ReadFile(path.Join(RuntimeArgs.SourcePath, "static/text/robots.txt")) + c.Data(200, "text/plain", robotsTxtFile) + } else if title == "sitemap.xml" { + robotsTxtFile, _ := ioutil.ReadFile(path.Join(RuntimeArgs.SourcePath, "static/text/sitemap.xml")) + c.Data(200, "text/plain", robotsTxtFile) } else if strings.ToLower(title) == "help" { //}&& strings.Contains(AllowedIPs, c.ClientIP()) != true { c.Redirect(302, "/Help/view") } else { diff --git a/static/text/robots.txt b/static/text/robots.txt index 1f53798..e0c6441 100644 --- a/static/text/robots.txt +++ b/static/text/robots.txt @@ -1,2 +1,4 @@ User-agent: * Disallow: / +Allow: /Help/view +Allow: /sitemap.xml diff --git a/static/text/sitemap.xml b/static/text/sitemap.xml new file mode 100755 index 0000000..726c9c7 --- /dev/null +++ b/static/text/sitemap.xml @@ -0,0 +1,9 @@ + + + + https://awwkoala.com/Help/view + 2016-03-18 + monthly + 1.0 + + diff --git a/templates/view.tmpl b/templates/view.tmpl index b2b3fa9..cff34a0 100644 --- a/templates/view.tmpl +++ b/templates/view.tmpl @@ -34,7 +34,7 @@ a.deleteable {