sitemap: tool to generate static xml
[sheet.git] / tools / mksitemap
diff --git a/tools/mksitemap b/tools/mksitemap
new file mode 100755 (executable)
index 0000000..cbfa8c9
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+use 5.014;
+use warnings;
+
+our $VERSION = '1.00';
+
+my @pages = (
+       [''],
+       [qw( readline vi digraphs charset unicode )],
+       [qw( vimperator mutt nethack mplayer )],
+       [qw( writing )],
+       [qw( source )],
+);
+
+my %freq = (
+       (map { $_ => 'yearly' } qw[ readline nethack mplayer ]),
+);
+
+say '<?xml version="1.0" encoding="UTF-8"?>';
+say '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
+for my $group (@pages) {
+       state $prio = 1;
+       for my $page (@{$group}) {
+               print '<url>';
+               print "<loc>http://sheet.shiar.nl/$page</loc>";
+               printf '<changefreq>%s</changefreq>', $freq{$page} // 'monthly';
+               printf '<priority>%.2f</priority>', $prio;
+               say '</url>';
+       }
+       $prio -= .1;
+}
+say '</urlset>';
+