Create index.xml.builder

This commit is contained in:
Tadhg
2019-04-21 16:44:57 -07:00
committed by GitHub
parent b0e46aec10
commit 153cf3b504

View File

@@ -0,0 +1,19 @@
xml.instruct! :xml, version: '1.0'
xml.tag! 'sitemapindex', 'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9" do
xml.tag! 'url' do
xml.tag! 'loc', root_url
end
xml.tag! 'url' do
xml.tag! 'loc', contact_url
end
@posts.each do |post|
xml.tag! 'url' do
xml.tag! 'loc', post_url(post)
xml.lastmod post.updated_at.strftime("%F")
end
end
end