diff --git a/app/Http/Controllers/FeedsController.php b/app/Http/Controllers/FeedsController.php
index a30c89dc..9aeb4abb 100644
--- a/app/Http/Controllers/FeedsController.php
+++ b/app/Http/Controllers/FeedsController.php
@@ -7,66 +7,13 @@ namespace App\Http\Controllers;
use App\Models\Article;
use App\Models\Note;
use Illuminate\Http\JsonResponse;
-use Illuminate\Http\Response;
class FeedsController extends Controller
{
- /**
- * Returns the blog RSS feed.
- */
- public function blogRss(): Response
- {
- $articles = Article::where('published', '1')->latest('updated_at')->take(20)->get();
- $buildDate = $articles->first()->updated_at->toRssString();
-
- return response()
- ->view('articles.rss', compact('articles', 'buildDate'))
- ->header('Content-Type', 'application/rss+xml; charset=utf-8');
- }
-
- /**
- * Returns the blog Atom feed.
- */
- public function blogAtom(): Response
- {
- $articles = Article::where('published', '1')->latest('updated_at')->take(20)->get();
-
- return response()
- ->view('articles.atom', compact('articles'))
- ->header('Content-Type', 'application/atom+xml; charset=utf-8');
- }
-
- /**
- * Returns the notes RSS feed.
- */
- public function notesRss(): Response
- {
- $notes = Note::latest()->take(20)->get();
- $buildDate = $notes->first()->updated_at->toRssString();
-
- return response()
- ->view('notes.rss', compact('notes', 'buildDate'))
- ->header('Content-Type', 'application/rss+xml; charset=utf-8');
- }
-
- /**
- * Returns the notes Atom feed.
- */
- public function notesAtom(): Response
- {
- $notes = Note::latest()->take(20)->get();
-
- return response()
- ->view('notes.atom', compact('notes'))
- ->header('Content-Type', 'application/atom+xml; charset=utf-8');
- }
-
- /** @todo sort out return type for json responses */
-
/**
* Returns the blog JSON feed.
*/
- public function blogJson(): array
+ public function blogJson(): JsonResponse
{
$articles = Article::where('published', '1')->latest('updated_at')->take(20)->get();
$data = [
@@ -94,13 +41,15 @@ class FeedsController extends Controller
];
}
- return $data;
+ return response()->json($data, 200, [
+ 'Content-Type' => 'application/feed+json',
+ ]);
}
/**
* Returns the notes JSON feed.
*/
- public function notesJson(): array
+ public function notesJson(): JsonResponse
{
$notes = Note::latest()->with('media', 'place', 'tags')->take(20)->get();
$data = [
@@ -130,7 +79,9 @@ class FeedsController extends Controller
}
}
- return $data;
+ return response()->json($data, 200, [
+ 'Content-Type' => 'application/feed+json',
+ ]);
}
/**
diff --git a/resources/views/articles/atom.blade.php b/resources/views/articles/atom.blade.php
deleted file mode 100644
index 9892bcfb..00000000
--- a/resources/views/articles/atom.blade.php
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- Atom feed for {{ config('user.display_name') }}’s blog
-
- {{ config('app.url')}}/blog
- {{ $articles[0]->updated_at->toAtomString() }}
-
-@foreach($articles as $article)
-
- {{ $article->title }}
-
- {{ config('app.url') }}{{ $article->link }}
- {{ $article->updated_at->toAtomString() }}
- {{ $article->main }}
-
- {{ config('user.display_name') }}
-
-
-@endforeach
-
diff --git a/resources/views/articles/rss.blade.php b/resources/views/articles/rss.blade.php
deleted file mode 100644
index 00268681..00000000
--- a/resources/views/articles/rss.blade.php
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- {{ config('user.display_name') }}
-
- An RSS feed of the blog posts found on {{ config('app.url') }}
- {{ config('app.url') }}/blog
- {{ $buildDate }}
- 1800
-
-@foreach($articles as $article)
- -
- {{ strip_tags($article->title) }}
-
- main }}
- @if($article->url)
Permalink
@endif
- ]]>
-
- @if($article->url != ''){{ $article->url }}@else{{ config('app.url') }}{{ $article->link }}@endif
- {{ config('app.url') }}{{ $article->link }}
- {{ $article->pubdate }}
-
-@endforeach
-
-
diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php
index 2e5c6b5a..f269d830 100644
--- a/resources/views/master.blade.php
+++ b/resources/views/master.blade.php
@@ -7,13 +7,9 @@
@yield('title'){{ config('app.name') }}
-
-
-
+
-
-
-
+
diff --git a/resources/views/notes/atom.blade.php b/resources/views/notes/atom.blade.php
deleted file mode 100644
index c84a4a93..00000000
--- a/resources/views/notes/atom.blade.php
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- Atom feed for {{ config('user.display_name') }}’s notes
-
- {{ config('app.url')}}/notes
- {{ $notes[0]->updated_at->toAtomString() }}
-
-@foreach($notes as $note)
-
- {{ strip_tags($note->note) }}
-
- {{ $note->uri }}
- {{ $note->updated_at->toAtomString() }}
- {{ $note->note }}
-
- {{ config('user.display_name') }}
-
-
-@endforeach
-
diff --git a/resources/views/notes/rss.blade.php b/resources/views/notes/rss.blade.php
deleted file mode 100644
index 9146ebe0..00000000
--- a/resources/views/notes/rss.blade.php
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- {{ config('user.display_name') }}
-
- An RSS feed of the notes found on {{ config('app.url') }}
- {{ config('app.url') }}/notes
- {{ $buildDate }}
- 1800
-
-@foreach($notes as $note)
- -
- {{ strip_tags($note->note) }}
-
- note !!}
- ]]>
-
- {{ $note->uri }}
- {{ $note->uri}}
- {{ $note->pubdate }}
-
-@endforeach
-
-
-
diff --git a/routes/web.php b/routes/web.php
index dd594480..b929a2de 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -170,8 +170,6 @@ Route::middleware(MyAuthMiddleware::class)->prefix('admin')->group(function () {
// Blog pages using ArticlesController
Route::prefix('blog')->group(function () {
- Route::get('/feed.rss', [FeedsController::class, 'blogRss'])->name('feed.blog.rss');
- Route::get('/feed.atom', [FeedsController::class, 'blogAtom'])->name('feed.blog.atom');
Route::get('/feed.json', [FeedsController::class, 'blogJson'])->name('feed.blog.json');
Route::get('/feed.jf2', [FeedsController::class, 'blogJf2'])->name('feed.blog.jf2');
Route::get('/s/{id}', [ArticlesController::class, 'onlyIdInURL']);
@@ -182,8 +180,6 @@ Route::prefix('blog')->group(function () {
// Notes pages using NotesController
Route::prefix('notes')->group(function () {
Route::get('/', [NotesController::class, 'index']);
- Route::get('/feed.rss', [FeedsController::class, 'notesRss'])->name('feed.notes.rss');
- Route::get('/feed.atom', [FeedsController::class, 'notesAtom'])->name('feed.notes.atom');
Route::get('/feed.json', [FeedsController::class, 'notesJson'])->name('feed.notes.json');
Route::get('/feed.jf2', [FeedsController::class, 'notesJf2'])->name('feed.notes.jf2');
Route::get('/new', [NotesController::class, 'create']);
diff --git a/tests/Feature/FeedsTest.php b/tests/Feature/FeedsTest.php
index 0323aa73..3f168b58 100644
--- a/tests/Feature/FeedsTest.php
+++ b/tests/Feature/FeedsTest.php
@@ -15,42 +15,6 @@ class FeedsTest extends TestCase
{
use RefreshDatabase;
- /**
- * Test the blog RSS feed.
- */
- #[Test]
- public function blog_rss_feed_is_present(): void
- {
- Article::factory()->count(3)->create();
- $response = $this->get('/blog/feed.rss');
- $response->assertHeader('Content-Type', 'application/rss+xml; charset=utf-8');
- $response->assertOk();
- }
-
- /**
- * Test the notes RSS feed.
- */
- #[Test]
- public function notes_rss_feed_is_present(): void
- {
- Note::factory()->count(3)->create();
- $response = $this->get('/notes/feed.rss');
- $response->assertHeader('Content-Type', 'application/rss+xml; charset=utf-8');
- $response->assertOk();
- }
-
- /**
- * Test the blog RSS feed.
- */
- #[Test]
- public function blog_atom_feed_is_present(): void
- {
- Article::factory()->count(3)->create();
- $response = $this->get('/blog/feed.atom');
- $response->assertHeader('Content-Type', 'application/atom+xml; charset=utf-8');
- $response->assertOk();
- }
-
#[Test]
public function blog_jf2_feed_is_present(): void
{
@@ -73,18 +37,6 @@ class FeedsTest extends TestCase
]);
}
- /**
- * Test the notes RSS feed.
- */
- #[Test]
- public function notes_atom_feed_is_present(): void
- {
- Note::factory()->count(3)->create();
- $response = $this->get('/notes/feed.atom');
- $response->assertHeader('Content-Type', 'application/atom+xml; charset=utf-8');
- $response->assertOk();
- }
-
/**
* Test the blog JSON feed.
*/
@@ -93,7 +45,7 @@ class FeedsTest extends TestCase
{
Article::factory()->count(3)->create();
$response = $this->get('/blog/feed.json');
- $response->assertHeader('Content-Type', 'application/json');
+ $response->assertHeader('Content-Type', 'application/feed+json');
$response->assertOk();
}
@@ -105,7 +57,7 @@ class FeedsTest extends TestCase
{
Note::factory()->count(3)->create();
$response = $this->get('/notes/feed.json');
- $response->assertHeader('Content-Type', 'application/json');
+ $response->assertHeader('Content-Type', 'application/feed+json');
$response->assertOk();
}