Skip to content

Instantly share code, notes, and snippets.

@norman
Created March 19, 2010 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norman/338082 to your computer and use it in GitHub Desktop.
Save norman/338082 to your computer and use it in GitHub Desktop.
class Sitemap
attr_accessor :entries
def add(array, &block)
array.map do |a|
if entry = block(a)
@entries << entry
end
end
end
end
sm = Sitemap.new
sm.add(paths) do |path|
if url =~ /my_public_stuff/
Entry.new(:path => path, :priority => 0.7, :frequency => "monthly")
elsif url =~ /my_private_stuff/
# don't include in sitemap
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment