fix some errors in sitemaps
Only show notices that don't have a remote URL. That should include only local notices. Also, don't do an avatar sitemap; apparently nobody indexes these anyways. darcs-hash:20080812011600-84dde-680d39ef8379605febd16ed52c529711e8e1ccc9.gz
This commit is contained in:
parent
e90004964f
commit
e5565ddcab
51
sitemap.php
51
sitemap.php
|
@ -11,7 +11,6 @@ $output_paths = parse_args();
|
||||||
standard_map();
|
standard_map();
|
||||||
notices_map();
|
notices_map();
|
||||||
user_map();
|
user_map();
|
||||||
avatar_map();
|
|
||||||
index_map();
|
index_map();
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -83,7 +82,7 @@ function notices_map() {
|
||||||
|
|
||||||
$notices = DB_DataObject::factory('notice');
|
$notices = DB_DataObject::factory('notice');
|
||||||
|
|
||||||
$notices->query('SELECT uri, modified FROM notice');
|
$notices->query('SELECT uri, url, modified FROM notice');
|
||||||
|
|
||||||
$notice_count = 0;
|
$notice_count = 0;
|
||||||
$map_count = 1;
|
$map_count = 1;
|
||||||
|
@ -96,16 +95,19 @@ function notices_map() {
|
||||||
$map_count++;
|
$map_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$notice = array(
|
# remote notices have an URL
|
||||||
|
|
||||||
|
if (!$notices->url) {
|
||||||
|
$notice = array(
|
||||||
'url' => $notices->uri,
|
'url' => $notices->uri,
|
||||||
'lastmod' => common_date_w3dtf($notices->modified),
|
'lastmod' => common_date_w3dtf($notices->modified),
|
||||||
'changefreq' => 'daily',
|
'changefreq' => 'daily',
|
||||||
'priority' => '1',
|
'priority' => '1',
|
||||||
);
|
);
|
||||||
|
|
||||||
$notice_list[$map_count] .= url($notice);
|
$notice_list[$map_count] .= url($notice);
|
||||||
|
$notice_count++;
|
||||||
$notice_count++;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make full sitemaps from the lists and save them.
|
# Make full sitemaps from the lists and save them.
|
||||||
|
@ -201,43 +203,6 @@ function user_map() {
|
||||||
array_to_map($foaf_list, 'foaf');
|
array_to_map($foaf_list, 'foaf');
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate sitemaps of all avatars.
|
|
||||||
function avatar_map() {
|
|
||||||
global $output_paths;
|
|
||||||
|
|
||||||
$avatars = new Avatar();
|
|
||||||
$avatars->whereAdd('original = 1', "OR");
|
|
||||||
$avatars->whereAdd('width = ' . AVATAR_MINI_SIZE, 'OR');
|
|
||||||
|
|
||||||
if (!$avatars->find()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$avatar_count = 0;
|
|
||||||
$map_count = 1;
|
|
||||||
|
|
||||||
while ($avatars->fetch()) {
|
|
||||||
|
|
||||||
# Maximum 50,000 URLs per sitemap file.
|
|
||||||
if ($avatar_count == 50000) {
|
|
||||||
$avatar_count = 0;
|
|
||||||
$map_count++;
|
|
||||||
}
|
|
||||||
$image = array(
|
|
||||||
'url' => common_avatar_display_url($avatars),
|
|
||||||
'lastmod' => common_date_w3dtf($avatars->modified),
|
|
||||||
'changefreq' => 'never',
|
|
||||||
'priority' => '0.2',
|
|
||||||
);
|
|
||||||
|
|
||||||
# Construct a <url></url> element for each avatar and add it
|
|
||||||
# to our existing list of those.
|
|
||||||
$avatar_list[$map_count] .= url($image);
|
|
||||||
}
|
|
||||||
|
|
||||||
array_to_map($avatar_list, 'avatars');
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# XML generation functions
|
# XML generation functions
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user