dmitryd/typo3-dd_googlesitemap

Picture in News Sitemap

Celine35 opened this issue · 3 comments

Hi,

We generated a txnews sitemap for Google news, but we noticed that pictures of news doesn’t appear in the Google news newsfeed.
I looked into the code of extension dd_googlesitemap and I see media file is not provided in the sitemap structure.

Maybe other users would be interested with this feature.

Thank you in advance for your interest.

Best regards

Hey,

if you would add these lines to /Classes/Renderers/NewsSitemapRenderer.php News-Extension could submit image data:

line 72:
public function getStartTags() { return '<?xml version="1.0" encoding="UTF-8"?>' . chr(10) . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" ' . 'xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" ' . 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" ' . '>' . chr(10); }

line 91:
public function renderEntry($url, $title, $lastModification = 0, $changeFrequency = '', $keywords = '', $priority = '', $image = '') {

line 105:
$content .= '</news:news>';
// Image
if ($image) {
$content .= 'image:image';
$content .= 'image:loc' . $image . '</image:loc>';
$content .= '</image:image>';
}
$content .= '';

$image should be the absolute image uri (string). Or as an array to submit more than one single image.

Best Regards

How would be $image passed to renderEntity?

No feedback provided.