Sha256: 8a1a4c98e43eb80c302144d5d644ac3a6d41b23691325e14581ef7342d213294
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require 'webgen/tag' module Webgen::Tag # Generates a breadcrumb trail for the page. This is especially useful when pages are in deep # hierarchies of directories. class BreadcrumbTrail include Webgen::Tag::Base # Create the breadcrumb trail. def call(tag, body, context) out = [] node = context.content_node omit_index_path = if node.meta_info.has_key?('omit_index_path') node['omit_index_path'] else param('tag.breadcrumbtrail.omit_index_path') end omit_index_path = omit_index_path && node.parent.routing_node(node.lang) == node node = node.parent if omit_index_path until node == node.tree.dummy_root context.dest_node.node_info[:used_meta_info_nodes] << node.routing_node(context.dest_node.lang).absolute_lcn context.dest_node.node_info[:used_meta_info_nodes] << node.absolute_lcn out.push(context.dest_node.link_to(node.in_lang(context.content_node.lang))) node = node.parent end out[0] = '' if param('tag.breadcrumbtrail.omit_last') && !omit_index_path out = out.reverse.join(param('tag.breadcrumbtrail.separator')) log(:debug) { "Breadcrumb trail for <#{context.dest_node.absolute_lcn}>: #{out}" } out end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webgen-0.5.2 | lib/webgen/tag/breadcrumbtrail.rb |