transformeurs_app/app/views/public/seo/_sitemap_localhost.builder
Nicolas Bally edc6aa0b89 Suite
2018-08-07 12:00:10 +02:00

205 lines
5.1 KiB
Ruby

xml.url do
xml.loc "http://transformeurs.quartz.xyz"
xml.lastmod w3c_date(Time.now)
xml.changefreq "always"
end
MenuItem.where(:parent_id => nil).all.each do |menu_item|
xml << render(:partial => "mi", :locals => {:menu_item => menu_item})
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/blog.html"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/en/blog.html"
xml.lastmod w3c_date(Time.now)
end
@articles = Article.before(Date.today).recents.joins(:lang_articles).where("lang_articles.enabled = 1 and lang_articles.lang_site_id = ?", @lang.id)
@articles.each do |article|
article.lang_articles.each do |lang_article|
if lang_article.enabled
xml.url do
xml.loc article_url(:slug => lang_article.slug, :lang => lang_article.lang_site.slug)
xml.lastmod w3c_date(article.updated_at)
end
end
end
end
@categories = Category.all
@categories.each do |category|
category.category_langs.each do |category_lang|
xml.url do
xml.loc category_public_article_path(:lang => category_lang.lang_site.slug,:slug => category_lang.slug)
xml.lastmod w3c_date(category.updated_at)
end
end
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/petitions.html"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/en/petitions.html"
xml.lastmod w3c_date(Time.now)
end
Petition.order("position ASC").all.each do |petition|
petition.petition_langs.each do |petition_lang|
if petition_lang.enabled
xml.url do
xml.loc petition_url(:slug => petition_lang.slug, :lang => petition_lang.lang_site.slug)
xml.lastmod w3c_date(petition.updated_at)
end
end
end
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/newsletters.html"
xml.lastmod w3c_date(Time.now)
end
Newsletter.where("send_at is not null").order("send_at DESC").each do |newsletter|
xml.url do
xml.loc public_newsletter_path(newsletter.slug)
xml.lastmod w3c_date(newsletter.updated_at)
end
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/presse"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/en/presse"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/presse"
xml.lastmod w3c_date(Time.now)
end
PressRelease.enableds.before(Time.now.end_of_day).order("published_at DESC").all.each do |press_release|
if press_release.press_type_id == 1
url = public_press_release_url(:id => press_release.slug, :lang => press_release.lang_site.slug )
else
url = public_sentience_url(:id => press_release.slug, :lang => press_release.lang_site.slug )
end
xml.url do
xml.loc url
xml.lastmod w3c_date(press_release.updated_at)
end
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/videos"
xml.lastmod w3c_date(Time.now)
end
InvestigationCat.where(:parent_id => nil).order("position ASC, name DESC").all.each do |investigation_cat|
xml.url do
xml.loc public_investigation_cat_path(investigation_cat)
xml.lastmod w3c_date(investigation_cat.updated_at)
end
end
VideoFile.recents.each do |video_file|
video_file.video_file_langs.each do |video_file_lang|
xml.url do
xml.loc public_video_file_url(:slug => video_file_lang.slug)
xml.lastmod w3c_date(video_file.updated_at)
end
end
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/boutique.html"
xml.lastmod w3c_date(Time.now)
end
ProductCategory.all.each do |product_category|
xml.url do
xml.loc public_product_category_url(:id => product_category.id, :slug => product_category.lang("fr").slug)
xml.lastmod w3c_date(product_category.updated_at)
end
end
Product.where(:archived => false).all.each do |product|
xml.url do
xml.loc public_product_url(:id => product.id, :slug => product.lang("fr").slug)
xml.lastmod w3c_date(product.updated_at)
end
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/faire-un-don"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/faire-un-don"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/parrainage"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/abonnements"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/fr/assurance-vie.html"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/en/faire-un-don"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/en/adhesion"
xml.lastmod w3c_date(Time.now)
end
xml.url do
xml.loc "http://transformeurs.quartz.xyz/en/parrainage"
xml.lastmod w3c_date(Time.now)
end