From c7f5b415c17b1ecbf1244f13c97cb89e74bec7c4 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 17 Oct 2019 02:59:47 +0200 Subject: [PATCH] sitemap.xml: calculate priority from path names --- sitemap.xml/index.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sitemap.xml/index.php b/sitemap.xml/index.php index 7d28815..f0f928b 100644 --- a/sitemap.xml/index.php +++ b/sitemap.xml/index.php @@ -12,6 +12,14 @@ foreach ($search->files() as $link) { $article = new ArchiveArticle($link); print ''; print "$siteref/{$article->link}"; + $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('%.2f', $score / 10); if ($article->last) { print "{$article->lastiso}"; } -- 2.30.0