git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
053009b
)
sitemap.xml: calculate priority from path names
author
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 17 Oct 2019 00:59:47 +0000
(
02:59
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 17 Oct 2019 01:00:36 +0000
(
03:00
+0200)
sitemap.xml/index.php
patch
|
blob
|
history
diff --git
a/sitemap.xml/index.php
b/sitemap.xml/index.php
index 7d288152ff9bce59f6aaedf6bf10ec140d70df90..f0f928bd5c4db75e9e4fdfb2d9187a0b8a14afdc 100644
(file)
--- a/
sitemap.xml/index.php
+++ b/
sitemap.xml/index.php
@@
-12,6
+12,14
@@
foreach ($search->files() as $link) {
$article = new ArchiveArticle($link);
print '<url>';
print "<loc>$siteref/{$article->link}</loc>";
$article = new ArchiveArticle($link);
print '<url>';
print "<loc>$siteref/{$article->link}</loc>";
+ $score = 10;
+ if ($article->link) {
+ $score -= substr_count($article->link, '/') + 1; # -10% per subdir
+ $age = time() - strtotime($article->dateiso);
+ $age /= 3600 * 24 * 365; # years
+ if ($age > .1) $score -= $age / 10 + .1; # -1% per year
+ }
+ printf('<priority>%.2f</priority>', $score / 10);
if ($article->last) {
print "<lastmod>{$article->lastiso}</lastmod>";
}
if ($article->last) {
print "<lastmod>{$article->lastiso}</lastmod>";
}