Enha: index.html to template
This commit is contained in:
		| @@ -1,3 +1,4 @@ | |||||||
|  | {{define "main"}} | ||||||
| <!DOCTYPE html> | <!DOCTYPE html> | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
| <head> | <head> | ||||||
| @@ -26,3 +27,4 @@ | |||||||
| 	</div> | 	</div> | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
|  | {{end}} | ||||||
|   | |||||||
| @@ -18,6 +18,10 @@ func HandlePing(w http.ResponseWriter, r *http.Request) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func HandleHome(w http.ResponseWriter, r *http.Request) { | func HandleHome(w http.ResponseWriter, r *http.Request) { | ||||||
| 	tmpl := template.Must(template.ParseFiles("components/index.html")) | 	tmpl, err := template.ParseGlob("components/*.html") | ||||||
| 	tmpl.Execute(w, roundWords) | 	if err != nil { | ||||||
|  | 		abortWithError(w, err.Error()) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	tmpl.ExecuteTemplate(w, "main", roundWords) | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder