{{if .Results}} + {{if .IsImageSearch}} +
+ {{range .Results}} + {{if eq .Template "images"}} + {{template "image_item" .}} + {{end}} + {{end}} +
+ {{else}} {{range .Results}} {{if eq .Template "videos"}} {{template "video_item" .}} + {{else if eq .Template "images"}} + {{template "image_item" .}} {{else}} {{template "result_item" .}} {{end}} {{end}} + {{end}} {{else if not .Answers}}
🔍
diff --git a/internal/views/views.go b/internal/views/views.go index c176f81..4162a03 100644 --- a/internal/views/views.go +++ b/internal/views/views.go @@ -52,6 +52,7 @@ type PageData struct { UnresponsiveEngines [][2]string PageNumbers []PageNumber ShowHeader bool + IsImageSearch bool // New fields for three-column layout Categories []string CategoryIcons map[string]string @@ -106,13 +107,13 @@ func init() { } tmplFull = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS, - "base.html", "results.html", "results_inner.html", "result_item.html", "video_item.html", + "base.html", "results.html", "results_inner.html", "result_item.html", "video_item.html", "image_item.html", )) tmplIndex = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS, "base.html", "index.html", )) tmplFragment = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS, - "results.html", "results_inner.html", "result_item.html", "video_item.html", + "results.html", "results_inner.html", "result_item.html", "video_item.html", "image_item.html", )) tmplPreferences = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS, "base.html", "preferences.html", @@ -168,6 +169,7 @@ func FromResponse(resp contracts.SearchResponse, query string, pageno int, activ "weather": "🌤️", }, ActiveCategory: activeCategory, + IsImageSearch: activeCategory == "images", // Time filters TimeFilters: []FilterOption{