refactor: Update sitemap configuration to support a new host name

- Modified the host name in the sitemap configuration to support the new domain.
- This commit changes the hostname, and updates the sitemap to reflect the correct host.
- This is done to reflect the correct host on the production server.
- Added the new `public/sitemaps` directory to .gitignore to avoid commits related to this
 directory, and updates the .gitignore.
This commit is contained in:
songtianlun 2025-02-17 00:27:44 +08:00
parent f02587da57
commit 31a2ec373d
2 changed files with 4 additions and 1 deletions

1
.gitignore vendored
View File

@ -40,3 +40,4 @@
.idea
public/sitemap.xml.gz
public/sitemaps

View File

@ -1,5 +1,7 @@
# Set the host name for URL creation
host = Rails.env.production? ? "https://todayaiweather.com" : "http://127.0.0.1:3000"
# host = Rails.env.production? ? "https://todayaiweather.com" : "http://127.0.0.1:3000"
host = Rails.env.production? ? "https://pub.r2.todayaiweather.com" : "http://127.0.0.1:3000"
# host = "https://pub.r2.todayaiweather.com"
Rails.application.routes.default_url_options[:host] = host
SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsSdkAdapter.new(
Rails.application.credentials.dig(:aws, :bucket),