module Middleman::Sitemap

Sitemap namespace

Sitemap namespace

Public Class Methods

included(app)
Alias for: registered
registered(app) click to toggle source

Once registered

# File lib/middleman-core/sitemap.rb, line 17
def registered(app)

  app.register Middleman::Sitemap::Extensions::Proxies
  app.register Middleman::Sitemap::Extensions::Ignores

  # Set to automatically convert some characters into a directory
  app.set :automatic_directory_matcher, nil

  # Setup callbacks which can exclude paths from the sitemap
  app.set :ignored_sitemap_matchers, {
    # dotfiles and folders in the root
    :root_dotfiles => proc { |file| file.start_with?('.') },

    # Files starting with an dot, but not .htaccess
    :source_dotfiles => proc { |file|
      file =~ %r{/\.} && file !~ %r{/\.(htaccess|htpasswd)}
    },

    # Files starting with an underscore, but not a double-underscore
    :partials => proc { |file| file =~ %r{/_} && file !~ %r{/__} },

    :layout => proc { |file|
      file.start_with?('source/layout.') || file.start_with?('source/layouts/')
    }
  }

  # Include instance methods
  app.send :include, InstanceMethods

  # Initialize Sitemap
  app.before_configuration do
    sitemap
  end
end
Also aliased as: included