summaryrefslogtreecommitdiff
path: root/sitemap.buetow.org/content/sitemap.inc.pl
blob: 6b08b823d9be75bfa1a0abe4782c51dee1b90619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
my $hostroot = $config->get_hostroot();

sub space () { " " x 10 }
sub nl () { "<br />\n" }

sub list (*) {
  my $tag = shift;
  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;
    }

    push @ret, nl;
  }

  join '', @ret;
}

list SITEMAP;