pagelets/navigation.js
function links(data, page, options) {
    if (!data || !data.length) return;

    var targets = ['self', 'blank', 'parent', 'top']
      , navigation = this;

    return data.reduce(function reduce(menu, item) {
      var url = item.href.split('/').filter(String)
        , active = url.shift();

      if (page) active = item.base || url.shift();
      item.active = ~navigation[page ? 'page' : 'base'].indexOf(active)
        ? ' class="active"'
        : '';

      item.target = item.target && ~targets.indexOf(item.target)
        ? ' target=_' + item.target
        : '';

      return menu + options.fn(item);
    }, '');
  }
function links(data, page, options) {
    if (!data || !data.length) return;

    var targets = ['self', 'blank', 'parent', 'top']
      , navigation = this;

    return data.reduce(function reduce(menu, item) {
      var url = item.href.split('/').filter(String)
        , active = url.shift();

      if (page) active = item.base || url.shift();
      item.active = ~navigation[page ? 'page' : 'base'].indexOf(active)
        ? ' class="active"'
        : '';

      item.target = item.target && ~targets.indexOf(item.target)
        ? ' target=_' + item.target
        : '';

      return menu + options.fn(item);
    }, '');
  }
function links ( data , page , options ) { if ( ! data || ! data . length ) return ; var targets = [ 'self' , 'blank' , 'parent' , 'top' ] , navigation = this ; return data . reduce ( function reduce ( menu , item ) { var url = item . href . split ( '/' ) . filter ( String ) , active = url . shift ( ) ; if ( page ) active = item . base || url . shift ( ) ; item . active = ~ navigation [ page ? 'page' : 'base' ] . indexOf ( active ) ? ' class="active"' : '' ; item . target = item . target && ~ targets . indexOf ( item . target ) ? ' target=_' + item . target : '' ; return menu + options . fn ( item ) ; } , '' ) ; }
Handblebar helper to generate the navigation entries. The base is defined by
the active page and should match the first part of the `href` route or the
provided menu entry `base`.

@param {Object} options
@param {Boolean} page Current iteration over page or root of url
@return {String} generated template
@api private
Handblebar helper to generate the navigation entries . The base is defined by the active page and should match the first part of the href route or the provided menu entry base .