- Change description to use @weather_art.prompt instead of a translated string with multiple parameters. - Update image_alt method to include the prompt in the descriptive text. These changes simplify the metadata generation for weather art and improve the clarity of the image descriptions by incorporating the prompt, which may provide users with additional context.
39 lines
1.3 KiB
Ruby
39 lines
1.3 KiB
Ruby
class WeatherArtsController < ApplicationController
|
|
include TagHelper
|
|
def show
|
|
@city = City.friendly.find(params[:city_id])
|
|
@weather_art = @city.weather_arts.friendly.find(params[:slug])
|
|
|
|
ahoy.track "View Weather Art", {
|
|
weather_art_id: @weather_art.id,
|
|
city_id: @weather_art.city_id,
|
|
event_type: "weather_art_view"
|
|
}
|
|
ahoy.track "View City", {
|
|
city_id: @city.id,
|
|
name: @city.name,
|
|
event_type: "city_view"
|
|
}
|
|
|
|
formatted_date = @weather_art.weather_date.strftime(t("date.formats.default"))
|
|
|
|
set_meta_tags(
|
|
title: t("meta.weather_arts.show.title",
|
|
city_name: @city.name,
|
|
date: formatted_date),
|
|
description: @weather_art.prompt,
|
|
# description: t("meta.weather_arts.show.description",
|
|
# city_name: @city.name,
|
|
# description: @weather_art.description,
|
|
# temperature: @weather_art.temperature),
|
|
keywords: t("meta.weather_arts.show.keywords",
|
|
city_name: @city.name,
|
|
country_name: @city.country.name,
|
|
description: @weather_art.description),
|
|
og: {
|
|
image: @weather_art.image.attached? ? url_for(@weather_art.image) : nil
|
|
}
|
|
)
|
|
end
|
|
end
|