- Implement meta tags in ArtsController, CitiesController, HomeController, and WeatherArtsController for better SEO. - Use translation helpers for titles, descriptions, and keywords to improve internationalization support. - Update default meta tags in ApplicationHelper for consistent site-wide SEO. These changes enhance the search engine visibility of the application by providing relevant meta information across various pages. Utilizing translation for these fields promotes better support for multiple languages, aligning with localization efforts.
38 lines
1.2 KiB
Ruby
38 lines
1.2 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: 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
|