package web import ( "html/template" "net/http" ) func JobsHandler(w http.ResponseWriter, r *http.Request) { jobs := []string{"Job 1", "Job 2", "Job 3"} // Replace with actual data fetching if r.Header.Get("HX-Request") == "true" { // This is an HTMX request, return the jobs content wrapped in the content template tmpl := template.Must(template.ParseFiles("templates/layout.html", "templates/partials/jobs.html")) tmpl.ExecuteTemplate(w, "content", map[string]interface{}{ "Title": "Jobs", "Jobs": jobs, }) } else { // This is a full page request tmpl := template.Must(template.ParseFiles("templates/layout.html", "templates/partials/jobs.html")) tmpl.Execute(w, map[string]interface{}{ "Title": "Jobs", "Jobs": jobs, }) } }