diff options
Diffstat (limited to 'sitemap.buetow.org/content')
| -rw-r--r-- | sitemap.buetow.org/content/sitemap.inc.pl | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/sitemap.buetow.org/content/sitemap.inc.pl b/sitemap.buetow.org/content/sitemap.inc.pl index 37740e7..6b08b82 100644 --- a/sitemap.buetow.org/content/sitemap.inc.pl +++ b/sitemap.buetow.org/content/sitemap.inc.pl @@ -1,36 +1,33 @@ my $hostroot = $config->get_hostroot(); -sub getf ($) { - open my $f, $_[0] or die "$!: $_[0]\n"; - my @slurp = <$f>; - close $f; - @slurp; -} - +sub space () { " " x 10 } sub nl () { "<br />\n" } sub list (*) { my $tag = shift; - my @found = sort `find $hostroot -name $tag`; - my $ret = ''; - - - for my $found (@found) { - $found =~ /.*hosts.(.*?).$tag/; - my $host = $1; - - my @content = getf $found; - - $ret .= "<b><a href=http://$host>$host</a></b>" . nl;; - - if (@content) { - $ret .= join " ", @content; - $ret .= nl; + my @homepages = sort `find $hostroot -name $tag`; + my @ret = (); + + for my $homepage (sort @homepages) { + my ($host) = $homepage =~ /.*hosts.(.*?).$tag/; + push @ret, "<b><a href='http://$host'>$host</a></b>", nl; + + my $sitepath = "$hostroot/$host"; + + my @pages = sort `find $sitepath -name \*.xml`; + for my $page (sort @pages) { + my ($site) = $page =~ m#$host/content/(.*)\.xml$#; + $site =~ s#\.sub/#/#g; + $site =~ s#\d\d\.##g; + next if $site eq 'home'; + my $sitelink = "http://$host?site=$site"; + push @ret, space, "<a href='$sitelink'>$site</a>", nl; } - $ret .= nl; + + push @ret, nl; } - $ret; + join '', @ret; } list SITEMAP; |
