This commit is contained in:
parent
37f4cfaade
commit
fcb49aa38c
1 changed files with 6 additions and 2 deletions
8
main.go
8
main.go
|
@ -39,6 +39,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mux := &gemini.Mux{}
|
mux := &gemini.Mux{}
|
||||||
|
mux.HandleFunc("/favicon.txt", processFavicon)
|
||||||
mux.HandleFunc("/", process)
|
mux.HandleFunc("/", process)
|
||||||
|
|
||||||
server := &gemini.Server{
|
server := &gemini.Server{
|
||||||
|
@ -54,8 +55,13 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func processFavicon(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
|
fmt.Fprintf(w, "\u263d")
|
||||||
|
}
|
||||||
|
|
||||||
func process(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
func process(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
fmt.Println(ctx, r, r.URL, r.Host)
|
fmt.Println(ctx, r, r.URL, r.Host)
|
||||||
|
|
||||||
renderIndex("en", w)
|
renderIndex("en", w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +93,7 @@ func renderIndex(lang string, w gemini.ResponseWriter) {
|
||||||
fmt.Println(c, count)
|
fmt.Println(c, count)
|
||||||
categories = categories + fmt.Sprintf("=> /%s%s/%s %s (%d)\n", langPath, "tree/path", c, c, count)
|
categories = categories + fmt.Sprintf("=> /%s%s/%s %s (%d)\n", langPath, "tree/path", c, c, count)
|
||||||
}
|
}
|
||||||
fmt.Println(page, categories)
|
|
||||||
page = strings.Replace(page, "{{categories}}", categories, 1)
|
page = strings.Replace(page, "{{categories}}", categories, 1)
|
||||||
fmt.Println(page)
|
|
||||||
|
|
||||||
tags := ""
|
tags := ""
|
||||||
for t, count := range tree.Tags {
|
for t, count := range tree.Tags {
|
||||||
|
|
Loading…
Reference in a new issue