feat: background photo system — random Lanzarote landscapes behind CV grid

Dev-only toggle button enables/disables photo backgrounds. Photos are
auto-discovered from static/images/backgrounds/ and randomly selected
on each page load. Production is unaffected — no button, no photo.
This commit is contained in:
juanatsap
2026-04-25 14:46:33 +01:00
parent fc1ca90b38
commit 3b6d5e781a
9 changed files with 122 additions and 11 deletions
+14
View File
@@ -352,6 +352,19 @@ func (h *CVHandler) prepareTemplateData(lang string) (map[string]interface{}, er
}
}
// Scan background photos (dev only)
var bgPhotos []string
if !isProduction {
bgDir := filepath.Join(c.DirStatic, "images", "backgrounds")
entries, _ := os.ReadDir(bgDir)
for _, e := range entries {
name := e.Name()
if !e.IsDir() && (strings.HasSuffix(name, ".jpg") || strings.HasSuffix(name, ".png") || strings.HasSuffix(name, ".webp")) {
bgPhotos = append(bgPhotos, "/static/images/backgrounds/"+name)
}
}
}
// Prepare template data
data := map[string]interface{}{
"CV": &cv,
@@ -366,6 +379,7 @@ func (h *CVHandler) prepareTemplateData(lang string) (map[string]interface{}, er
"AlternateEN": "https://juan.andres.morenorub.io/?lang=en",
"AlternateES": "https://juan.andres.morenorub.io/?lang=es",
"ChatEnabled": h.chatEnabled,
"BgPhotos": bgPhotos,
}
return data, nil