sitemap: tool to generate static xml
[sheet.git] / tools / mksitemap
1 #!/usr/bin/env perl
2 use 5.014;
3 use warnings;
4
5 our $VERSION = '1.00';
6
7 my @pages = (
8         [''],
9         [qw( readline vi digraphs charset unicode )],
10         [qw( vimperator mutt nethack mplayer )],
11         [qw( writing )],
12         [qw( source )],
13 );
14
15 my %freq = (
16         (map { $_ => 'yearly' } qw[ readline nethack mplayer ]),
17 );
18
19 say '<?xml version="1.0" encoding="UTF-8"?>';
20 say '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
21 for my $group (@pages) {
22         state $prio = 1;
23         for my $page (@{$group}) {
24                 print '<url>';
25                 print "<loc>http://sheet.shiar.nl/$page</loc>";
26                 printf '<changefreq>%s</changefreq>', $freq{$page} // 'monthly';
27                 printf '<priority>%.2f</priority>', $prio;
28                 say '</url>';
29         }
30         $prio -= .1;
31 }
32 say '</urlset>';
33