add dynamic sitemap.xml
This commit is contained in:
41
app/views/static/sitemap.xml.erb
Normal file
41
app/views/static/sitemap.xml.erb
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
|
||||
<url>
|
||||
<loc><%= posts_url %></loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc><%= wiki_pages_url %></loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc><%= pools_url %></loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<%# cache("sitemap", :expires_in => 24.hours) do %>
|
||||
<% @popular_search_service.each_search do |tags, count| %>
|
||||
<url>
|
||||
<loc><%= posts_url(tags: tags) %></loc>
|
||||
<lastmod><%= Date.today %></lastmod>
|
||||
</url>
|
||||
<% end %>
|
||||
|
||||
<% @posts.each do |post| %>
|
||||
<url>
|
||||
<loc><%= post_url(post) %></loc>
|
||||
<image:image>
|
||||
<image:loc>
|
||||
<%= post.file_url %>
|
||||
</image:loc>
|
||||
<image:caption>
|
||||
<%= post.presenter.humanized_essential_tag_string %>
|
||||
</image:caption>
|
||||
</image:image>
|
||||
<lastmod><%= post.created_at.to_date %></lastmod>
|
||||
</url>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
</urlset>
|
||||
Reference in New Issue
Block a user