gorgeous-ghost-95789
04/26/2023, 12:18 AMgorgeous-ghost-95789
04/26/2023, 12:20 AMgorgeous-ghost-95789
04/26/2023, 12:22 AMhundreds-stone-62176
05/10/2023, 8:31 PMancient-continent-47302
05/11/2023, 4:53 AMancient-continent-47302
05/11/2023, 4:53 AMambitious-intern-12893
05/11/2023, 8:34 AMancient-continent-47302
05/11/2023, 8:57 AMancient-continent-47302
05/11/2023, 8:57 AMambitious-intern-12893
05/11/2023, 9:11 AMcuddly-keyboard-70746
05/12/2023, 1:14 PMcuddly-keyboard-70746
05/12/2023, 1:15 PMhundreds-stone-62176
05/12/2023, 1:15 PMmysterious-car-3675
05/12/2023, 2:03 PMworried-kangaroo-95467
05/23/2023, 6:48 PMwhite-architect-71886
05/24/2023, 7:07 PMsquare-bird-9707
05/25/2023, 9:55 PMthankful-balloon-21810
05/26/2023, 1:09 AMhtml/template
and I'm not sure what I do wrong here. for a certain route my code looks like this:
go
session := Get_Session(r)
view := ProfileView{UserName: session.UserName}
var tmpl *template.Template
if r.Header.Get("HX-Request") == "true" {
tmpl, _ = template.ParseFiles("htmx/profile.html")
tmpl.ExecuteTemplate(w, "content", view) // empty response
//tmpl.Execute(w, view) // empty response as well
} else {
tmpl, _ = template.ParseFiles("htmx/index.html", "htmx/profile.html")
home_view := HomeView{
Session: session,
Content: view,
}
tmpl.Execute(w, home_view) // works properly
}
index.html
has a {{block "content" .Content}}{{end}}
profile.html
is a {{define "content"}} ... {{end}}
do I need a dummy content.html
just to have a different way to apply the template?bored-photographer-4726
05/26/2023, 5:17 AMParseFiles
and ExecuteTemplate
. likely one of those will have a clue for yougreat-cartoon-12331
05/27/2023, 8:07 PM.html
extension? VSCode has built-in support for HTMLthankful-balloon-21810
05/27/2023, 8:47 PMsalmon-xylophone-28580
05/28/2023, 7:14 AMminiature-lizard-24702
05/28/2023, 12:12 PMminiature-lizard-24702
05/28/2023, 12:12 PMminiature-lizard-24702
05/28/2023, 12:13 PMmysterious-car-3675
05/28/2023, 2:29 PMthankful-balloon-21810
05/28/2023, 10:53 PMgreat-cartoon-12331
05/28/2023, 11:09 PMthankful-balloon-21810
05/29/2023, 12:10 AM