module ApplicationHelper def weather_art_schema(weather_art) { "@context": "https://schema.org", "@type": "ImageObject", "name": "#{weather_art.city.name} Weather Art", "description": weather_art.description, "datePublished": weather_art.created_at.iso8601, "contentUrl": url_for(weather_art.image), "author": { "@type": "Organization", "name": "TodayAIWeather" }, "locationCreated": { "@type": "Place", "name": weather_art.city.name, "address": { "@type": "PostalAddress", "addressCountry": weather_art.city.country.name } } }.to_json.html_safe if weather_art.image.attached? end end