1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 21:32:09 +02:00

Closes #4760 - Added image support to generated Google sitemaps.

This commit is contained in:
Cameron
2022-04-21 11:51:52 -07:00
parent c2fc8fce0a
commit fe8d27c51c
2 changed files with 34 additions and 5 deletions

View File

@@ -101,15 +101,25 @@ class news_gsitemap
{
$data = $this->getNewsPosts();
/** @var news_shortcodes $sc */
$sc = e107::getScBatch('news');
e107::getParser()->thumbWidth(1000);
$ret = [];
foreach($data as $row)
{
$sc->setScVar('news_item', $row);
$imgUrl = $sc->sc_news_image(['item'=>1, 'type'=>'src']);
$ret[] = [
'url' => $this->url('news', $row),
'lastmod' => !empty($row['news_modified']) ? $row['news_modified'] : (int) $row['news_datestamp'],
'freq' => 'hourly',
'priority' => 0.5
'priority' => 0.5,
'image' => (strpos($imgUrl, 'http') === 0) ? $imgUrl : SITEURLBASE.$sc->sc_news_image(['item'=>1, 'type'=>'src']),
];
}