From 0ff9ad4ff97fe5881af96d04ddd9a9146fcda97a Mon Sep 17 00:00:00 2001 From: songtianlun Date: Tue, 8 Apr 2025 15:24:29 +0800 Subject: [PATCH] fix: update URL slugs for cities and weather arts - Changed URLs to use city slugs instead of IDs - Updated corresponding URLs for weather arts to use slugs This change ensures that the URLs are more readable and maintainable by using slugs rather than numerical IDs. It improves SEO and user experience when accessing city and weather art pages. --- app/workers/submit_to_indexnow_worker.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/workers/submit_to_indexnow_worker.rb b/app/workers/submit_to_indexnow_worker.rb index 8213805..3a567a6 100644 --- a/app/workers/submit_to_indexnow_worker.rb +++ b/app/workers/submit_to_indexnow_worker.rb @@ -76,9 +76,9 @@ class SubmitToIndexnowWorker # 城市详情页 City.where("updated_at > ?", recently_updated).find_each do |city| # City.find_each do |city| - urls << "#{@host}/cities/#{city.id}" + urls << "#{@host}/cities/#{city.slug}" available_locales.each do |locale| - urls << "#{@host}/#{locale}/cities/#{city.id}" + urls << "#{@host}/#{locale}/cities/#{city.slug}" end end @@ -86,9 +86,9 @@ class SubmitToIndexnowWorker WeatherArt.includes(:city).where("updated_at > ?", recently_updated).find_each do |art| # WeatherArt.includes(:city).find_each do |art| if art.image.attached? - urls << "#{@host}/cities/#{art.city.id}/weather_arts/#{art.id}" + urls << "#{@host}/cities/#{art.city.slug}/weather_arts/#{art.slug}" available_locales.each do |locale| - urls << "#{@host}/#{locale}/cities/#{art.city.id}/weather_arts/#{art.id}" + urls << "#{@host}/#{locale}/cities/#{art.city.slug}/weather_arts/#{art.slug}" end end end