1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-13 03:54:04 +02:00

[CssSelectorBridge] Time/Thumbnail improvements (#3879) (#3901)

* Implement <time> metadata tag as timestamp source
* Add setting to include thumbnail as article header
This commit is contained in:
ORelio
2024-01-19 21:30:53 +01:00
committed by GitHub
parent 12a90e2074
commit bb36eb9eb8
3 changed files with 42 additions and 5 deletions

View File

@@ -58,6 +58,11 @@ class SitemapBridge extends CssSelectorBridge
'title' => 'Some sites set their logo as thumbnail for every article. Use this option to discard it.',
'type' => 'checkbox',
],
'thumbnail_as_header' => [
'name' => '[Optional] Insert thumbnail as article header',
'title' => 'Insert article main image on top of article contents.',
'type' => 'checkbox',
],
'limit' => self::LIMIT
]
];
@@ -71,6 +76,7 @@ class SitemapBridge extends CssSelectorBridge
$title_cleanup = $this->getInput('title_cleanup');
$site_map = $this->getInput('site_map');
$discard_thumbnail = $this->getInput('discard_thumbnail');
$thumbnail_as_header = $this->getInput('thumbnail_as_header');
$limit = $this->getInput('limit');
$this->feedName = $this->titleCleanup($this->getPageTitle($this->homepageUrl), $title_cleanup);
@@ -87,6 +93,9 @@ class SitemapBridge extends CssSelectorBridge
if ($discard_thumbnail && isset($item['enclosures'])) {
unset($item['enclosures']);
}
if ($thumbnail_as_header && isset($item['enclosures'])) {
$item['content'] = '<p><img src="' . $item['enclosures'][0] . '" /></p>' . $item['content'];
}
$this->items[] = $item;
}
}