Update go tmpl name
This commit is contained in:
parent
29902fc2f1
commit
fc3b0ba68d
@ -1,7 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
func (app *application) VirtualTerminal(w http.ResponseWriter, r *http.Request) {
|
func (app *application) VirtualTerminal(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
if err := app.renderTemplate(w, r, "terminal", nil); err != nil {
|
||||||
|
app.errorLog.Println(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ func (app *application) renderTemplate(
|
|||||||
) error {
|
) error {
|
||||||
var t *template.Template
|
var t *template.Template
|
||||||
var err error
|
var err error
|
||||||
templateToRender := fmt.Sprintf("templates/%s.page.tmpl", page)
|
templateToRender := fmt.Sprintf("templates/%s.page.gohtml", page)
|
||||||
|
|
||||||
_, templateInMap := app.templateCache[templateToRender]
|
_, templateInMap := app.templateCache[templateToRender]
|
||||||
|
|
||||||
@ -79,15 +79,15 @@ func (app *application) parseTemplate(
|
|||||||
// build partials
|
// build partials
|
||||||
if len(partials) > 0 {
|
if len(partials) > 0 {
|
||||||
for i, x := range partials {
|
for i, x := range partials {
|
||||||
partials[i] = fmt.Sprintf("tempaltes/%s.partial.tmpl", x)
|
partials[i] = fmt.Sprintf("tempaltes/%s.partial.gohtml", x)
|
||||||
}
|
}
|
||||||
t, err = template.New(fmt.Sprintf("%s.page.tmpl", page)).
|
t, err = template.New(fmt.Sprintf("%s.page.gohtml", page)).
|
||||||
Funcs(functions).
|
Funcs(functions).
|
||||||
ParseFS(templateFS, "templates/base.layout.tmpl", strings.Join(partials, ","), templateToRender)
|
ParseFS(templateFS, "templates/base.layout.gohtml", strings.Join(partials, ","), templateToRender)
|
||||||
} else {
|
} else {
|
||||||
t, err = template.New(fmt.Sprintf("%s.page.tmpl", page)).
|
t, err = template.New(fmt.Sprintf("%s.page.gohtml", page)).
|
||||||
Funcs(functions).
|
Funcs(functions).
|
||||||
ParseFS(templateFS, "templates/base.layout.tmpl", templateToRender)
|
ParseFS(templateFS, "templates/base.layout.gohtml", templateToRender)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.errorLog.Println(err)
|
app.errorLog.Println(err)
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{{define "base"}}
|
|
||||||
|
|
||||||
{{end}}
|
|
Loading…
x
Reference in New Issue
Block a user