From 41150ba78b56b639336870773a52daa81409835c Mon Sep 17 00:00:00 2001 From: songtianlun Date: Tue, 8 Apr 2025 16:33:10 +0800 Subject: [PATCH] fix: update city title for improved SEO - Change title format to include city and country names - Comment out default title setting to avoid fallback This update enhances the title tag used in the meta data of city pages, providing better search engine optimization by including both the city name and its country. The change also comments out the default title with a fallback to avoid showing an incorrect title when the city details are not available. --- app/controllers/cities_controller.rb | 2 +- app/views/layouts/application.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/cities_controller.rb b/app/controllers/cities_controller.rb index 571c59e..b49372c 100644 --- a/app/controllers/cities_controller.rb +++ b/app/controllers/cities_controller.rb @@ -58,7 +58,7 @@ class CitiesController < ApplicationController } set_meta_tags( - title: @city.name, + title: "#{@city.name}, #{@city&.country&.name}", description: "Experience #{@city.name}'s weather through AI-generated art. Daily updates of weather conditions visualized through artificial intelligence.", keywords: "#{@city.name}, #{@city.country.name}, ai, ai web, ai art, ai weather, weather art, AI visualization", og: { diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b8df202..131a066 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - <%= content_for(:title) || "Today Ai Weather" %> +