Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -4250,6 +4250,20 @@ |
4251 | 4251 | */ |
4252 | 4252 | $wgSitemapNamespaces = false; |
4253 | 4253 | |
| 4254 | +/** |
| 4255 | + * Custom namespace priorities for sitemaps. Setting this will allow you to |
| 4256 | + * set custom priorities to namsepaces when sitemaps are generated using the |
| 4257 | + * maintenance/generateSitemap.php script. |
| 4258 | + * |
| 4259 | + * This should be a map of namespace IDs to priority |
| 4260 | + * Example: |
| 4261 | + * $wgSitemapNamespacesPriorities = array( |
| 4262 | + * NS_USER => '0.9', |
| 4263 | + * NS_HELP => '0.0', |
| 4264 | + * ); |
| 4265 | + */ |
| 4266 | +$wgSitemapNamespacesPriorities = false; |
| 4267 | + |
4254 | 4268 | /** @} */ # end of search settings |
4255 | 4269 | |
4256 | 4270 | /************************************************************************//** |
Index: trunk/phase3/maintenance/generateSitemap.php |
— | — | @@ -162,6 +162,8 @@ |
163 | 163 | } |
164 | 164 | |
165 | 165 | private function setNamespacePriorities() { |
| 166 | + global $wgSitemapNamespacesPriorities; |
| 167 | + |
166 | 168 | // Custom main namespaces |
167 | 169 | $this->priorities[self::GS_MAIN] = '0.5'; |
168 | 170 | // Custom talk namesspaces |
— | — | @@ -183,6 +185,19 @@ |
184 | 186 | $this->priorities[NS_HELP_TALK] = '0.1'; |
185 | 187 | $this->priorities[NS_CATEGORY] = '0.5'; |
186 | 188 | $this->priorities[NS_CATEGORY_TALK] = '0.1'; |
| 189 | + |
| 190 | + // Custom priorities |
| 191 | + if ( $wgSitemapNamespacesPriorities !== false ) { |
| 192 | + foreach ( $wgSitemapNamespacesPriorities as $namespace => $priority ) { |
| 193 | + $float = floatval( $priority ); |
| 194 | + if ( $float > 1.0 ) { |
| 195 | + $priority = '1.0'; |
| 196 | + } elseif ( $float < 0.0 ) { |
| 197 | + $priority = '0.0'; |
| 198 | + } |
| 199 | + $this->priorities[$namespace] = $priority; |
| 200 | + } |
| 201 | + } |
187 | 202 | } |
188 | 203 | |
189 | 204 | /** |