[WM] can't get sitemap grep attribute to work

Duncan Cameron dcameron.bcs.org.uk
Sun Feb 17 16:12:01 GMT 2002


On 2002-02-18 Maximilian Mehnert wrote:
>Hy!
>
>I've to say that this software is real cool! - You've got a new fan in Germany! :)
>It took me some time to work through it but by the time I began loving it.
>
>Being not the ultimate perl guru I finally failed to get the sitemap grep attribute to work.
>I would be glad if someone really kind could post a few lines with a working example.
>
>Greetings from Berlin!
>
>Max
There's a bug in SiteMap.pm. The grep parameter is not being passed correctly
when generating the site  map.

You need to add the following line to the assignment of the $context variable
in the map_site() method.It's line 129 in my version.

      'grep'			=> $contobj->{grep},

    my $context = {
      'top'			=> $top,
      'include_generated'	=> $map_generated_content,
      'sortby'			=> $contobj->{sortorder},
      'node'			=> $contobj->{sitemap_node_name},
      'leaf'			=> $contobj->{sitemap_leaf_name},
      'dynamic'			=> $contobj->{sitemap_dynamic_name},
      'up'			=> undef,
      'prev'			=> undef,
    };

Then something like this will work:

grep="!/foo/" => exclude content with name which matches 'foo'
grep="/bar/"  => include only content which matches 'bar'
grep="!/foo|bar|baz/" => exclude content with name which matches 'foo' or 'bar' or 'baz'
grep="($_ eq 'foo' || $_ eq 'bar' || $_ eq 'baz') ? 0 : 1)" => similar 

You'll need to read up about Perl regular expressions.

Regards,
Duncan Cameron





More information about the Webmake-talk mailing list