pass page path automatically to header

This commit is contained in:
ethan merchant 2024-11-03 02:10:46 -05:00
parent 3c182fc1df
commit 28d7648c50

View file

@ -20,7 +20,6 @@ func Render(
w http.ResponseWriter,
r *http.Request,
template string,
page string,
title string,
desc string,
page_data interface{},
@ -28,21 +27,21 @@ func Render(
w.WriteHeader(http.StatusOK)
data := struct {
Host string
Page string
Title string
Desc string
Local bool
Root bool
Data interface{}
Host string
PagePath string
Title string
Desc string
Local bool
Root bool
Data interface{}
}{
Host: r.Host,
Page: page,
Title: title,
Desc: desc,
Local: true, // (os.Getenv("LOCAL") == "true"), // toggle here for flag testing
Root: true, // (os.Getenv("HOST_IDEABRELLA") == strings.ReplaceAll(r.Host, ":3000", "")),
Data: page_data,
Host: r.Host,
PagePath: r.URL.Path, // *see header canonical link
Title: title,
Desc: desc,
Local: true, // (os.Getenv("LOCAL") == "true"), // toggle here for flag testing
Root: true, // (os.Getenv("HOST_DOFDEV") == strings.ReplaceAll(r.Host, ":3000", "")),
Data: page_data,
}
err := Templates.ExecuteTemplate(w, template, data)