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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user