<?php
-ob_clean();
header('Content-Type: application/atom+xml; charset=utf-8');
print '<?xml version="1.0" encoding="utf-8"?>';
$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
$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>";
}