New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemap generator #259

Closed
nicolasgarnil opened this Issue Feb 3, 2012 · 8 comments

Comments

Projects
None yet
4 participants
@nicolasgarnil
Copy link

nicolasgarnil commented Feb 3, 2012

Hi, I'm working in a sitemap generator for my middleman site.

Is there any way to retrieve all the html pages of the site?

Thanks in advanced.

Nicolas

@tdreyno

This comment has been minimized.

Copy link
Member

tdreyno commented Feb 3, 2012

In 3.0, there is a sitemap class for traversal, but it isn't stabilized or documented yet.

@tdreyno tdreyno closed this Mar 4, 2012

@nicolasgarnil

This comment has been minimized.

Copy link
Author

nicolasgarnil commented Mar 13, 2012

Great!!! I'll wait for the feature to be officially available :)

@dhulihan

This comment has been minimized.

Copy link

dhulihan commented Jan 21, 2013

I threw together a very basic txt & xml sitemap generator for middleman. Here's the gist.

# config.rb
page "/sitemap.xml", :layout => false
# data/site.yml
url: http://www.example.com
<%# 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 %>
# 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
@tdreyno

This comment has been minimized.

Copy link
Member

tdreyno commented Jan 22, 2013

Looks great @dhulihan. Any interest in either writing a blog post about this or releasing as an extension?

@dhulihan

This comment has been minimized.

Copy link

dhulihan commented Jan 22, 2013

@tdreyno - Sure, I'd be interested in moving this to an extension. I'm fairly new to middleman (nice work btw), so this might be a good way to learn the ropes. I'll keep you posted if I come up with anything presentable. 🍕

@nicolasgarnil

This comment has been minimized.

@iwarner

This comment has been minimized.

Copy link
Member

iwarner commented Aug 14, 2013

For Google Searches there is also this: https://github.com/pixelpark/middleman-sitemap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment