Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
Use https for badge.
Browse files Browse the repository at this point in the history
  • Loading branch information
garyburd committed Dec 21, 2013
1 parent 948d14e commit 2be0522
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion database/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ func normalizeProjectRoot(projectRoot string) string {
}

var synonyms = map[string]string{
"redis": "redisdb",
"redis": "redisdb", // append db to avoid stemming to 'red'
"rand": "random",
"postgres": "postgresql",
"mongo": "mongodb",
}
Expand Down
6 changes: 3 additions & 3 deletions gddo-server/assets/templates/tools.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ <h2>Tools for {{$.pdoc.PageName}}</h2>

<h3>Badge</h3>

<p><a href="http://{{.host}}/{{.pdoc.ImportPath}}"><img src="{{.uri}}" alt="GoDoc"></a>
<p><a href="{{.uri}}"><img src="{{.uri}}?status.png" alt="GoDoc"></a>

<p>Use one of the snippets below to add a link to GoDoc from your project
website or README file:</a>

<h5>HTML</h5>
<input type="text" value='<a href="http://{{.host}}/{{.pdoc.ImportPath}}"><img src="{{.uri}}" alt="GoDoc"></a>' class="click-select form-control">
<input type="text" value='<a href="{{.uri}}"><img src="{{.uri}}?status.png" alt="GoDoc"></a>' class="click-select form-control">

<h5>Markdown</h5>
<input type="text" value="[![GoDoc]({{.uri}})](http://{{.host}}/{{.pdoc.ImportPath}})" class="click-select form-control">
<input type="text" value="[![GoDoc]({{.uri}}?status.png)]({{.uri}})" class="click-select form-control">

{{if .pdoc.Name}}
<h3>Lint</h3>
Expand Down
8 changes: 6 additions & 2 deletions gddo-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,13 @@ func servePackage(resp http.ResponseWriter, req *http.Request) error {
"pdoc": newTDoc(pdoc),
})
case isView(req, "tools"):
proto := "http"
if req.Host == "godoc.org" {
proto = "https"
}
return executeTemplate(resp, "tools.html", http.StatusOK, nil, map[string]interface{}{
"uri": fmt.Sprintf("http://%s/%s?status.png", req.Host, importPath),
"uri": fmt.Sprintf("%s://%s/%s", proto, req.Host, importPath),
"pdoc": newTDoc(pdoc),
"host": req.Host,
})
case isView(req, "redir"):
if srcFiles == nil {
Expand Down Expand Up @@ -890,6 +893,7 @@ func main() {
mux.Handle("/robots.txt", staticServer.FileHandler("robots.txt"))
mux.Handle("/BingSiteAuth.xml", staticServer.FileHandler("BingSiteAuth.xml"))
mux.Handle("/C", http.RedirectHandler("http://golang.org/doc/articles/c_go_cgo.html", 301))
mux.Handle("/ajax.googleapis.com/", http.NotFoundHandler())
mux.Handle("/", handler(serveHome))

cacheBusters.Handler = mux
Expand Down

0 comments on commit 2be0522

Please sign in to comment.