sitemap generator
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -109,5 +109,8 @@ gem 'bootstrap-kaminari-views', :git=>'git://github.com/matenia/bootstrap-kamina
|
|||||||
#gem 'will_paginate', :git=>'git://github.com/mislav/will_paginate.git'
|
#gem 'will_paginate', :git=>'git://github.com/mislav/will_paginate.git'
|
||||||
#gem 'bootstrap-will_paginate'
|
#gem 'bootstrap-will_paginate'
|
||||||
|
|
||||||
|
|
||||||
gem 'sunspot_rails'
|
gem 'sunspot_rails'
|
||||||
gem 'sunspot_solr'
|
gem 'sunspot_solr'
|
||||||
|
gem 'sitemap_generator'
|
||||||
|
|
||||||
|
|||||||
49
config/sitemap.rb
Normal file
49
config/sitemap.rb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# Set the host name for URL creation
|
||||||
|
SitemapGenerator::Sitemap.default_host = "http://localhost:3000"
|
||||||
|
|
||||||
|
SitemapGenerator::Sitemap.create do
|
||||||
|
add root_path
|
||||||
|
Globalize.with_locale(:de) do
|
||||||
|
Neuigkeit.public.find_each do |neuigkeit|
|
||||||
|
add neuigkeit_path(neuigkeit,:locale=>:de,:theme=>"default"),:lastmod=>neuigkeit.updated_at, :news=>{:title=>neuigkeit.title, :publication_language=>"de", :publication_date=>neuigkeit.datum}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Globalize.with_locale(:en) do
|
||||||
|
Neuigkeit.public.with_translations(:en).find_each do |neuigkeit|
|
||||||
|
add neuigkeit_path(neuigkeit,:locale=>:en,:theme=>"default"),:lastmod=>neuigkeit.updated_at, :news=>{:title=>neuigkeit.title,:publication_language=>"en",:publication_date=>neuigkeit.datum}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Globalize.with_locale(:en) do
|
||||||
|
Thema.public.with_translations(:en).find_each do |thema|
|
||||||
|
add thema_path(thema, :locale=>:en, :theme=>"default"),:lastmod=>thema.updated_at
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Globalize.with_locale(:de) do
|
||||||
|
Thema.public.with_translations(:de).find_each do |thema|
|
||||||
|
add thema_path(thema, :locale=>:de, :theme=>"default"),:lastmod=>thema.updated_at, :alternate=>{:href=>thema_path(thema, :locale=>:de, :theme=>"blue1"), :lang=>"de"}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
# 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
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user