
xml.url do
  xml.loc         "https://payre3p.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         "https://payre3p.quartz.xyz/fr/blog.html"
  xml.lastmod     w3c_date(Time.now)
end
xml.url do
  xml.loc         "https://payre3p.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         "https://payre3p.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




