1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Improved robots, added sitemap. Locking is simpler now and allows direct click to edit.

Former-commit-id: 09ad353e7940058aad4e578949b2e4a58cb6a044 [formerly 52f9d99e471a7b490f6c0915a0d49593d6b51916] [formerly f0e82719115da8fd767cc99c8981c59094a69ca3 [formerly 9ec76efd33]]
Former-commit-id: e9bb713ba99798071e3f9376e790417d36d34c31 [formerly 69a662985ced356cc3f8657fa4b98117beec9f48]
Former-commit-id: d1f51141039bc8656e8a9ae906a2389e7103081c
This commit is contained in:
Zack Scholl 2016-03-18 08:39:41 -04:00
parent 580d6cba68
commit cbc14d7014
5 changed files with 17 additions and 5 deletions

View File

@ -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 {

View File

@ -1,2 +1,4 @@
User-agent: *
Disallow: /
Allow: /Help/view
Allow: /sitemap.xml

9
static/text/sitemap.xml Executable file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://awwkoala.com/Help/view</loc>
<lastmod>2016-03-18</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
</urlset>

View File

@ -34,7 +34,7 @@ a.deleteable {
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/{{ .Title }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li>
<li>{{ if .Locked }}<a href="#" class="postunlock"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span>{{else}}<a href="/{{ .Title }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>{{end}} Edit</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" class="active"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View <span class="caret"></span></a>
<ul class="dropdown-menu">

View File

@ -16,7 +16,6 @@ import (
var animals []string
var adjectives []string
var robotsTxt string
var aboutPageText string
type versionsInfo struct {
@ -30,8 +29,6 @@ func init() {
animals = strings.Split(string(animalsText), ",")
adjectivesText, _ := ioutil.ReadFile(path.Join(RuntimeArgs.SourcePath, "static/text/adjectives"))
adjectives = strings.Split(string(adjectivesText), "\n")
robotsTxtFile, _ := ioutil.ReadFile(path.Join(RuntimeArgs.SourcePath, "static/text/robots.txt"))
robotsTxt = string(robotsTxtFile)
}
func randomAnimal() string {