middleman sitemap generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config.rb | |
page "/sitemap.xml", :layout => false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# data/site.yml | |
url: http://www.example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source/sitemap.txt.erb | |
<% root_url = data.site.url %> | |
<% sitemap.resources.each do |page| %> | |
<%= "#{root_url}#{page.url}\n" if page.url !~ /\.(css|js|eot|svg|woff|ttf|png|jpg)$/ %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source/sitemap.xml.builder | |
xml.instruct! | |
xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do | |
sitemap.resources.each do |resource| | |
xml.url do | |
xml.loc "#{data.site.url}#{resource.url}" | |
end if resource.url !~ /\.(css|js|eot|svg|woff|ttf|png|jpg)$/ | |
end | |
end |
hello, gem 'builder' no works for me. When i try your files, sitemap.xml.builder is the same on my folder build in middleman
Thanks in advance
Jul
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks great. Thank you.
Worth to note:
Gemfile
robots.txt.erb