pass page path automatically to header
This commit is contained in:
parent
3c182fc1df
commit
28d7648c50
1 changed files with 14 additions and 15 deletions
29
tem/tem.go
29
tem/tem.go
|
@ -20,7 +20,6 @@ func Render(
|
||||||
w http.ResponseWriter,
|
w http.ResponseWriter,
|
||||||
r *http.Request,
|
r *http.Request,
|
||||||
template string,
|
template string,
|
||||||
page string,
|
|
||||||
title string,
|
title string,
|
||||||
desc string,
|
desc string,
|
||||||
page_data interface{},
|
page_data interface{},
|
||||||
|
@ -28,21 +27,21 @@ func Render(
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
|
||||||
data := struct {
|
data := struct {
|
||||||
Host string
|
Host string
|
||||||
Page string
|
PagePath string
|
||||||
Title string
|
Title string
|
||||||
Desc string
|
Desc string
|
||||||
Local bool
|
Local bool
|
||||||
Root bool
|
Root bool
|
||||||
Data interface{}
|
Data interface{}
|
||||||
}{
|
}{
|
||||||
Host: r.Host,
|
Host: r.Host,
|
||||||
Page: page,
|
PagePath: r.URL.Path, // *see header canonical link
|
||||||
Title: title,
|
Title: title,
|
||||||
Desc: desc,
|
Desc: desc,
|
||||||
Local: true, // (os.Getenv("LOCAL") == "true"), // toggle here for flag testing
|
Local: true, // (os.Getenv("LOCAL") == "true"), // toggle here for flag testing
|
||||||
Root: true, // (os.Getenv("HOST_IDEABRELLA") == strings.ReplaceAll(r.Host, ":3000", "")),
|
Root: true, // (os.Getenv("HOST_DOFDEV") == strings.ReplaceAll(r.Host, ":3000", "")),
|
||||||
Data: page_data,
|
Data: page_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := Templates.ExecuteTemplate(w, template, data)
|
err := Templates.ExecuteTemplate(w, template, data)
|
||||||
|
|
Loading…
Add table
Reference in a new issue