Skip to content

Commit 5452ab2

Browse files
committed
Include collection homepage url in sitemap
1 parent ec492c4 commit 5452ab2

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

inc/collections/model/_blog.class.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5898,6 +5898,47 @@ function get_item_denomination( $position = 'evobar_new' )
58985898

58995899
return isset( $denominations[ $position ] ) ? $denominations[ $position ] : '';
59005900
}
5901+
5902+
5903+
/**
5904+
* Get last touched date of content in this collection
5905+
*
5906+
* @param string Date/Time format: leave empty to use locale default date format, use FALSE to don't format
5907+
* @param boolean TRUE if you want GMT
5908+
* @return string Last touched date
5909+
*/
5910+
function get_last_touched_date( $format = false, $useGM = false )
5911+
{
5912+
if( empty( $this->ID ) )
5913+
{ // Collection must be saved in DB:
5914+
return false;
5915+
}
5916+
5917+
if( ! isset( $this->last_touched_date ) )
5918+
{ // Load last touched date from DB:
5919+
global $DB;
5920+
$SQL = new SQL( 'Get last touched date for collection #'.$this->ID );
5921+
$SQL->SELECT( 'cat_last_touched_ts' );
5922+
$SQL->FROM( 'T_categories' );
5923+
$SQL->WHERE( 'cat_blog_ID = '.$this->ID );
5924+
$SQL->ORDER_BY( 'cat_last_touched_ts DESC' );
5925+
$SQL->LIMIT( '1' );
5926+
// Store date in cache:
5927+
$this->last_touched_date = $DB->get_var( $SQL );
5928+
}
5929+
5930+
if( $format === false )
5931+
{ // Don't format:
5932+
return $this->last_touched_date;
5933+
}
5934+
5935+
if( empty( $format ) )
5936+
{ // Use format of current locale:
5937+
$format = locale_datefmt();
5938+
}
5939+
5940+
return mysql2date( $format, $this->last_touched_date, $useGM );
5941+
}
59015942
}
59025943

59035944
?>

skins/_sitemap/index.main.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// Filter list:
2626
$MainList->set_filters( array(
2727
'visibility_array' => array( 'published' ), // We only want to advertised published items
28-
'itemtype_usage' => 'post,page', // keep normal posts & pages BUT STILL EXCLUDE intros and sidebar links
28+
'itemtype_usage' => 'post,page,intro-front,intro-main,intro-cat,intro-tag,intro-sub,intro-all', // keep normal posts, pages and intro-* BUT STILL EXCLUDE all others special(sidebar link, advertisement), content blocks
2929
'unit' => 'all', // We want to advertise all items (not just a page or a day)
3030
'cat_focus' => $cat_focus,
3131
) );
@@ -56,6 +56,12 @@
5656
?>
5757

5858
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
59+
<url>
60+
<loc><?php echo $Blog->get( 'url' ); ?></loc>
61+
<lastmod><?php echo $Blog->get_last_touched_date( 'isoZ', true ); ?></lastmod>
62+
<priority>1</priority>
63+
<changefreq>daily</changefreq>
64+
</url>
5965
<?php
6066
while( $Item = & mainlist_get_item() )
6167
{ // For each blog post, do everything below up to the closing curly brace "}"

0 commit comments

Comments
 (0)