git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
040b34c
)
sitemap: include file dates in lastmod attribute
author
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 2 May 2017 22:02:15 +0000
(
00:02
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 29 May 2017 17:23:12 +0000
(19:23 +0200)
tools/mksitemap
patch
|
blob
|
history
diff --git
a/tools/mksitemap
b/tools/mksitemap
index 4948525137c260aae74898cbf9c3ede7dc837eb4..7b9c5a01016e530108d9a7822f3a1b8e87c41c7f 100755
(executable)
--- a/
tools/mksitemap
+++ b/
tools/mksitemap
@@
-4,6
+4,9
@@
use warnings;
our $VERSION = '1.00';
our $VERSION = '1.00';
+use File::stat;
+use Time::Piece;
+
my @pages = (
[qw( index )],
[qw( readline vi digraphs charset unicode )],
my @pages = (
[qw( index )],
[qw( readline vi digraphs charset unicode )],
@@
-24,12
+27,14
@@
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;
say '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
for my $group (@pages) {
state $prio = 1;
- for my $page (@{$group}) {
- $page =~ s/\Aindex\z//;
+ for my $file (@{$group}) {
+ (my $page = $file) =~ s/\Aindex\z//;
+ $file .= '.plp';
print '<url>';
print "<loc>http://sheet.shiar.nl/$page</loc>";
printf '<changefreq>%s</changefreq>', $freq{$page} // 'monthly';
printf '<priority>%.2f</priority>', $prio;
print '<url>';
print "<loc>http://sheet.shiar.nl/$page</loc>";
printf '<changefreq>%s</changefreq>', $freq{$page} // 'monthly';
printf '<priority>%.2f</priority>', $prio;
+ printf '<lastmod>%s</lastmod>', localtime(stat($file)->mtime)->date;
say '</url>';
}
$prio -= .1;
say '</url>';
}
$prio -= .1;