feat(rss): add rss feed route without the `.xml` extension

closes #247
This commit is contained in:
Yassine Doghri 2022-10-14 12:50:25 +00:00
parent 9e9375f9a2
commit 94c0b7c159
5 changed files with 8 additions and 6 deletions

View File

@ -185,11 +185,13 @@ $routes->group('@(:podcastHandle)', static function ($routes): void {
});
});
$routes->head('feed.xml', 'FeedController/$1', [
'as' => 'podcast_feed',
'as' => 'podcast-rss-feed',
]);
$routes->get('feed.xml', 'FeedController/$1', [
'as' => 'podcast_feed',
'as' => 'podcast-rss-feed',
]);
$routes->head('feed', 'FeedController/$1');
$routes->get('feed', 'FeedController/$1');
});
// Other pages

View File

@ -324,7 +324,7 @@ class Podcast extends Entity
public function getFeedUrl(): string
{
return url_to('podcast_feed', $this->attributes['handle']);
return url_to('podcast-rss-feed', $this->attributes['handle']);
}
/**

View File

@ -550,7 +550,7 @@ class PodcastModel extends Model
{
if (! array_key_exists('guid', $data['data']) || $data['data']['guid'] === null) {
helper('misc');
$data['data']['guid'] = podcast_uuid(url_to('podcast_feed', $data['data']['handle']));
$data['data']['guid'] = podcast_uuid(url_to('podcast-rss-feed', $data['data']['handle']));
}
return $data;

View File

@ -143,7 +143,7 @@ class PodcastImportController extends BaseController
'guid' => $guid,
'handle' => $this->request->getPost('handle'),
'imported_feed_url' => $this->request->getPost('imported_feed_url'),
'new_feed_url' => url_to('podcast_feed', $this->request->getPost('handle')),
'new_feed_url' => url_to('podcast-rss-feed', $this->request->getPost('handle')),
'title' => (string) $feed->channel[0]->title,
'description_markdown' => $converter->convert($channelDescriptionHtml),
'description_html' => $channelDescriptionHtml,

View File

@ -1,7 +1,7 @@
<div data-sidebar-toggler="backdrop" class="absolute top-0 left-0 z-10 hidden w-full h-full bg-backdrop/75 md:hidden" role="button" tabIndex="0" aria-label="<?= lang('Common.close') ?>"></div>
<aside id="podcast-sidebar" data-sidebar-toggler="sidebar" data-toggle-class="hidden" data-hide-class="hidden" class="z-20 hidden h-full col-span-1 col-start-2 row-start-1 p-4 py-6 shadow-2xl md:shadow-none md:block bg-base">
<div class="sticky z-10 bg-base top-12">
<a href="<?= route_to('podcast_feed', esc($podcast->handle)) ?>" class="inline-flex items-center mb-6 text-sm font-semibold focus:ring-accent text-skin-muted hover:text-skin-base group" target="_blank" rel="noopener noreferrer">
<a href="<?= $podcast->feed_url ?>" class="inline-flex items-center mb-6 text-sm font-semibold focus:ring-accent text-skin-muted hover:text-skin-base group" target="_blank" rel="noopener noreferrer">
<?= icon('rss', ' mr-2 bg-orange-500 text-xl text-white group-hover:bg-orange-700 p-1 w-6 h-6 inline-flex items-center justify-center rounded-lg') . lang('Podcast.feed') ?>
</a>
<?php if (