Parent

Class/Module Index [+]

Quicksearch

Webgen::Tag::Sitemap

Generates a sitemap. The sitemap contains the hierarchy of all pages on the web site.

Public Instance Methods

call(tag, body, context) click to toggle source

Create the sitemap.

# File lib/webgen/tag/sitemap.rb, line 11
def call(tag, body, context)
  tree = website.blackboard.invoke(:create_sitemap, context.dest_node, context.content_node.lang, @params)
  (tree.children.empty? ? '' : output_sitemap(tree, context))
end

Private Instance Methods

output_sitemap(tree, context) click to toggle source

Create the HTML representation of the sitemap nodes in tree in respect to context.

# File lib/webgen/tag/sitemap.rb, line 26
def output_sitemap(tree, context)
  out = "<ul>"
  tree.children.each do |child|
    sub = (child.children.length > 0 ? output_sitemap(child, context) : '')
    out << "<li>" + context.dest_node.link_to(child.node, :lang => child.node.lang || context.content_node.lang)
    out << sub
    out << "</li>"
  end
  out << "</ul>"
  out
end
tag_config_base() click to toggle source

The modified tag base to support the easy specification of common.sitemap.* options.

# File lib/webgen/tag/sitemap.rb, line 21
def tag_config_base
  'common.sitemap'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.