我正在使用 sitemap_generator gem 自动生成站点地图。它已经配置、测试并且可以在本地运行,但是当我在我的 Dokku 容器上进行生产时,尝试运行dokku run tradfood rake -s sitemap:refresh
时,会出现以下行:
City Load (0.7ms) SELECT "cities".* FROM "cities" ORDER BY "cities"."id" ASC LIMIT $1 [["LIMIT", 1000]]
Recipe Load (2.5ms) SELECT "recipes".* FROM "recipes" ORDER BY "recipes"."id" ASC LIMIT $1 [["LIMIT", 1000]]
City Load (8.1ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (1.3ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (0.3ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (0.2ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (0.2ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (0.3ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (0.2ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (0.2ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
City Load (0.2ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
但是什么都没有生成:当我运行时dokku run tradfood ls -all public
,sitemap.xml 停留到 oct。21.
我的 Dokku 持久存储仍然可以在生产中使用我的图像上传器(它可以很好地记录新图像,使用载波)。
这是我的 sitemap.rb 配置:
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "https://tradfood.fr"
SitemapGenerator::Sitemap.create(:compress => false) do
# Put links creation logic here.
#
# The root path '/' and sitemap index file are added automatically for you.
# Links are added to the Sitemap in the order they are specified.
#
# Usage: add(path, options={})
# (default options are used if you don't specify)
#
# Defaults: :priority => 0.5, :changefreq => 'weekly',
# :lastmod => Time.now, :host => default_host
#
# Examples:
#
# Add '/articles'
#
# add articles_path, :priority => 0.7, :changefreq => 'daily'
#
# Add all articles:
#
# Article.find_each do |article|
# add article_path(article), :lastmod => article.updated_at
# end
add '/a-propos', :changefreq => 'monthly'
City.find_each do |city|
add city_path(city.name.parameterize), :lastmod => city.updated_at, :changefreq => 'weekly', :priority => 0.8
end
Recipe.find_each do |recipe|
add recipe_path(recipe.city.name.parameterize, recipe.name.parameterize), :lastmod => recipe.updated_at, :changefreq => 'daily'
end
end