Class: Webgen::Common::Sitemap

Inherits:
Object
  • Object
show all
Includes:
WebsiteAccess
Defined in:
lib/webgen/common/sitemap.rb

Overview

This class provides functionality for creating sitemaps and checking if a sitemap has changed.

Instance Method Summary collapse

Methods included from WebsiteAccess

included, website

Constructor Details

#initializeSitemap

:nodoc:



13
14
15
# File 'lib/webgen/common/sitemap.rb', line 13

def initialize #:nodoc:
  website.blackboard.add_listener(:node_changed?, method(:node_changed?))
end

Instance Method Details

#create_sitemap(node, lang, options) ⇒ Object

Return the sitemap tree as Webgen::Tag::Menu::MenuNode created for the node in the language lang using the provided options which can be any configuration option starting with common.sitemap.



20
21
22
23
24
25
26
# File 'lib/webgen/common/sitemap.rb', line 20

def create_sitemap(node, lang, options)
  @options = options
  tree = recursive_create(nil, node.tree.root, lang).sort!
  @options = nil
  (node.node_info[:common_sitemap] ||= {})[[options.to_a.sort, lang]] = tree.to_lcn_list
  tree
end