package templates // AltTextPlaceholder generates SEO-friendly alt text for images // Replace placeholders with actual data before use type ImageContext struct { Subject string // What is shown in the image Context string // What's happening / setting Location string // Where the image was taken Relevance string // Why it's relevant to the page } func GenerateAltText(ctx ImageContext) string { // Pattern: [Subject] + [Context] + [Location] + [Relevance] // Example: "Wedding photographer capturing moments at outdoor ceremony in Salt Lake City" parts := []string{} if ctx.Subject != "" { parts = append(parts, ctx.Subject) } if ctx.Context != "" { parts = append(parts, ctx.Context) } if ctx.Location != "" { parts = append(parts, "in "+ctx.Location) } if ctx.Relevance != "" { parts = append(parts, ctx.Relevance) } alt := strings.Join(parts, " ") // Truncate to 125 characters max (SEO best practice) if len(alt) > 125 { alt = alt[:122] + "..." } return alt } // Example usage: // alt := GenerateAltText(ImageContext{ // Subject: "Bride and groom", // Context: "exchanging vows", // Location: "Salt Lake City Temple", // Relevance: "wedding ceremony", // }) // Result: "Bride and groom exchanging vows in Salt Lake City Temple wedding ceremony"