diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-08-11 21:16:00 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-08-11 21:16:00 -0400 |
commit | e5565ddcab9de0af337e084c925548a2ccf370e4 (patch) | |
tree | 3d294a8307920f9f533baf843467ce92da9c2567 /sitemap.php | |
parent | e90004964fdb60e88e5e77d0ee035679c251ccfd (diff) |
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
Diffstat (limited to 'sitemap.php')
-rw-r--r-- | sitemap.php | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/sitemap.php b/sitemap.php index ca1819658..8480207be 100644 --- a/sitemap.php +++ b/sitemap.php @@ -11,7 +11,6 @@ $output_paths = parse_args(); standard_map(); notices_map(); user_map(); -avatar_map(); index_map(); # ------------------------------------------------------------------------------ @@ -83,7 +82,7 @@ function notices_map() { $notices = DB_DataObject::factory('notice'); - $notices->query('SELECT uri, modified FROM notice'); + $notices->query('SELECT uri, url, modified FROM notice'); $notice_count = 0; $map_count = 1; @@ -96,16 +95,19 @@ function notices_map() { $map_count++; } - $notice = array( + # remote notices have an URL + + if (!$notices->url) { + $notice = array( 'url' => $notices->uri, 'lastmod' => common_date_w3dtf($notices->modified), 'changefreq' => 'daily', 'priority' => '1', ); - $notice_list[$map_count] .= url($notice); - - $notice_count++; + $notice_list[$map_count] .= url($notice); + $notice_count++; + } } # Make full sitemaps from the lists and save them. @@ -201,43 +203,6 @@ function user_map() { 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 # ------------------------------------------------------------------------------ |