Expose RSS feed
Though actually its the json feed 🤫
This commit is contained in:
parent
d264b8bdc3
commit
ba9330cdf1
9 changed files with 41 additions and 2 deletions
|
@ -102,7 +102,7 @@ class FeedsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function notesJson(): array
|
public function notesJson(): array
|
||||||
{
|
{
|
||||||
$notes = Note::latest()->with('media')->take(20)->get();
|
$notes = Note::latest()->with('media', 'place')->take(20)->get();
|
||||||
$data = [
|
$data = [
|
||||||
'version' => 'https://jsonfeed.org/version/1',
|
'version' => 'https://jsonfeed.org/version/1',
|
||||||
'title' => 'The JSON Feed for ' . config('user.display_name') . '’s notes',
|
'title' => 'The JSON Feed for ' . config('user.display_name') . '’s notes',
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -19,4 +19,10 @@ a {
|
||||||
& a:visited {
|
& a:visited {
|
||||||
color: var(--color-link);
|
color: var(--color-link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .rss-icon {
|
||||||
|
& svg {
|
||||||
|
color: var(--rss-color-link);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,13 @@
|
||||||
#site-header {
|
#site-header {
|
||||||
grid-column: 2 / 3;
|
grid-column: 2 / 3;
|
||||||
grid-row: 1 / 2;
|
grid-row: 1 / 2;
|
||||||
|
|
||||||
|
& .rss-icon {
|
||||||
|
& svg {
|
||||||
|
width: auto;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
|
@ -19,4 +19,5 @@
|
||||||
--color-link: oklch(48.09% 0.146 241.41deg);
|
--color-link: oklch(48.09% 0.146 241.41deg);
|
||||||
--color-link-visited: oklch(70.44% 0.21 304.41deg);
|
--color-link-visited: oklch(70.44% 0.21 304.41deg);
|
||||||
--color-primary-shadow: oklch(19.56% 0.054 125.505deg / 40%);
|
--color-primary-shadow: oklch(19.56% 0.054 125.505deg / 40%);
|
||||||
|
--rss-color-link: oklch(67.59% 0.189 42.04deg);
|
||||||
}
|
}
|
||||||
|
|
13
resources/views/icons/rss.blade.php
Normal file
13
resources/views/icons/rss.blade.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
@php
|
||||||
|
if (isset($title)) {
|
||||||
|
$uniqueId = bin2hex(random_bytes(6));
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"
|
||||||
|
@if($title)aria-labelledby="{{ $uniqueId }}"@endif
|
||||||
|
>
|
||||||
|
@if($title)<title id="{{ $uniqueId }}">{{ $title }}</title>@endif
|
||||||
|
<path d="M4 11a9 9 0 0 1 9 9"></path>
|
||||||
|
<path d="M4 4a16 16 0 0 1 16 16"></path>
|
||||||
|
<circle cx="5" cy="19" r="1"></circle>
|
||||||
|
</svg>
|
|
@ -47,6 +47,7 @@
|
||||||
<a href="/likes">Likes</a>
|
<a href="/likes">Likes</a>
|
||||||
<a href="/contacts">Contacts</a>
|
<a href="/contacts">Contacts</a>
|
||||||
<a href="/projects">Projects</a>
|
<a href="/projects">Projects</a>
|
||||||
|
<a href="/notes/feed.json" class="rss-icon">@include('icons.rss', ['title' => 'RSS Feed'])</a>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace Tests\Feature;
|
||||||
|
|
||||||
use App\Models\Article;
|
use App\Models\Article;
|
||||||
use App\Models\Note;
|
use App\Models\Note;
|
||||||
|
use App\Models\Place;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
@ -159,4 +160,14 @@ class FeedsTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function jsonNoteFeedLoadsPlaceDataWithoutLazyLoading(): void
|
||||||
|
{
|
||||||
|
$place = Place::factory()->create();
|
||||||
|
Note::factory()->create(['note' => null, 'place_id' => $place->id]);
|
||||||
|
$response = $this->get('/notes/feed.json');
|
||||||
|
|
||||||
|
$response->assertOk();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue