diff --git a/controller/routes.go b/controller/routes.go index d4018dd..1ed0035 100644 --- a/controller/routes.go +++ b/controller/routes.go @@ -69,12 +69,15 @@ func saveHandler(w http.ResponseWriter, r *http.Request, title string) { func renderTemplate(w http.ResponseWriter, tmpl string, p *model.Page) { // err := templates.ExecuteTemplate(w, "templates/"+tmpl+".html", p) - t, err := template.ParseFiles("templates/" + tmpl + ".html") + t, err := template.ParseFiles(getTmplName("base"), getTmplName(tmpl)) checkError(err, w) err = t.Execute(w, p) checkError(err, w) } +func getTmplName(tmpl string) string { + return tmplDir + tmpl + ".html" +} func checkError(err error, w http.ResponseWriter) { if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/controller/settings.go b/controller/settings.go index 06df662..cbef706 100644 --- a/controller/settings.go +++ b/controller/settings.go @@ -1,3 +1,4 @@ package controller var Port int = 8080 +var tmplDir string = "templates/" diff --git a/data/doc.txt b/data/doc.txt new file mode 100644 index 0000000..938475e --- /dev/null +++ b/data/doc.txt @@ -0,0 +1,7 @@ +Type a term in the search bar. + +If it already exist you will reach this page. + +If it is not yet defined you will have the possibility to create it. + +Have fun \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..5e73351 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,74 @@ + + +
+ + + + + + ++ Golang powered Wiki web application +
++ Look at our documentation to discover how to contribute ! +
+ Documentation[edit]