[Mediawiki-l] site map

Aaron Sherman ajs at ajs.com
Mon Mar 6 21:17:25 UTC 2006


On Sat, 2006-03-04 at 18:27 +0100, jdd wrote:
> Hello :-)
> 
> Do you know of any mean to build a sitemap on a mediawiki
> (other than by hand)?

Well I use this Perl "one liner" to map, that uses graphviz to visualize
the connectivity of Categories:

(echo "digraph G {";echo 'aspect="1"';perl -MLWP::Simple -le '$n="Toplevel category name";$base="http://www.yourwiki.com/yourwikibase";sub trans {local $_=shift;s/([^ :.\-\w])/sprintf "%%%2X",ord($1)/egi;s/ /_/g;return $_}sub untrans {local $_=shift;s/_/ /g;s/\%([a-f0-9]{2})/chr(hex("0x".$1))/egi;$_}push @pages,$n;while($p=shift @pages){$w="$base/Category:".trans($p);print STDERR $w;sleep 1;$h=get($w);while($h=~/href=\"[^\"]*\bCategory:\s*([^\"\#\?\&]+)[\?\#\"]/g){$n=untrans($1);push(@{$point{$n}},$p),push(@pages,$n) unless $seen{$n}++ || $all{"$n==$p"}++ || $all{"$p==$n"};}}foreach $p (sort keys %point){print qq{"$_" -> "$p"} foreach @{$point{$p}}}';echo "}") | tee YOURWIKI.dot | dot -Tpng > YOURWIKI.png 

>From that I get:
http://www.ajs.com/ajswiki/Image:AJSWIKI.png

Of course, it's just a visual map, but you can use this concept to come
up with a map that's more interactive if you like.

-- 
Aaron Sherman <ajs at ajs.com>
Senior Systems Engineer and Toolsmith
"We had some good machines, but they don't work no more." -Shriekback





More information about the MediaWiki-l mailing list