Module: Middleman::Sitemap

Defined in:
lib/middleman-core/sitemap/store.rb,
lib/middleman-core/sitemap.rb,
lib/middleman-core/sitemap/resource.rb,
lib/middleman-core/sitemap/extensions/ignores.rb,
lib/middleman-core/sitemap/extensions/on_disk.rb,
lib/middleman-core/sitemap/extensions/proxies.rb,
lib/middleman-core/sitemap/extensions/traversal.rb

Overview

Sitemap namespace

Defined Under Namespace

Modules: Extensions, InstanceMethods Classes: Resource, Store

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object Also known as: included

Once registered



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 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