diff --git a/about.html b/about.html new file mode 100644 index 0000000..26519ec --- /dev/null +++ b/about.html @@ -0,0 +1,9 @@ +{{template "header.html"}} + +

The Imperial Library of Trantor (also known as Galactic Library) is a repository of ebooks on ePub format.

+ +

You can upload your books. And one of our librarians will take care to store them on our bast bookshelfs and make it avaliable for the rest of the galaxy.

+ +

We like to pay the authors, but not the corporations that make profit from them. We won't listen to any content remove request from corporations, editorials, right management organizations or any other blood-shuckers.

+ +{{template "footer.html"}} diff --git a/header.html b/header.html index c786647..601c880 100644 --- a/header.html +++ b/header.html @@ -3,3 +3,4 @@ Imperial Library of Trantor +Index || About || Upload your epub diff --git a/template.go b/template.go index 7ebd0e3..358a1b2 100644 --- a/template.go +++ b/template.go @@ -7,7 +7,7 @@ import ( func loadTemplate(w http.ResponseWriter, tmpl string, data interface{}) { // TODO: when finish devel conver to global: - var templates = template.Must(template.ParseFiles("header.html", "footer.html", "index.html", "book.html", "search.html", "upload.html")) + var templates = template.Must(template.ParseFiles("header.html", "footer.html", "index.html", "about.html", "book.html", "search.html", "upload.html")) err := templates.ExecuteTemplate(w, tmpl+".html", data) if err != nil { diff --git a/trantor.go b/trantor.go index 804382c..5c36440 100644 --- a/trantor.go +++ b/trantor.go @@ -12,6 +12,10 @@ const ( BOOKS_COLL = "books" ) +func aboutHandler(w http.ResponseWriter, r *http.Request) { + loadTemplate(w, "about", nil) +} + func bookHandler(coll *mgo.Collection, w http.ResponseWriter, r *http.Request) { var book Book coll.Find(bson.M{"title": r.URL.Path[len("/book/"):]}).One(&book) @@ -36,6 +40,7 @@ func main() { http.HandleFunc("/book/", func(w http.ResponseWriter, r *http.Request) { bookHandler(coll, w, r) }) http.HandleFunc("/search/", func(w http.ResponseWriter, r *http.Request) { searchHandler(coll, w, r) }) http.HandleFunc("/upload/", func(w http.ResponseWriter, r *http.Request) { uploadHandler(coll, w, r) }) + http.HandleFunc("/about/", aboutHandler) fileHandler("/img/") fileHandler("/cover/") fileHandler("/books/")