Skip to content

Commit

Permalink
fix: add top-level author to json feed (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
trovster authored May 27, 2022
1 parent d2c5839 commit e879dce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resources/views/json.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
@if(!empty($meta['image']))
"icon": "{{ $meta['image'] }}",
@endif
"authors": [@foreach($items->unique('authorName') as $item){
"name": "{{ $item->authorName }}"
}@if(! $loop->last),@endif
@endforeach

],
"items": [@foreach($items as $item){
"id": "{{ url($item->id) }}",
"title": "{{ $item->title }}",
Expand All @@ -29,7 +35,7 @@
],
@endif
"tags": [ {!! implode(',', array_map(fn($c) => '"'.$c.'"', $item->category)) !!} ]
}@if($item !== $items->last()),
}@if(! $loop->last),
@endif
@endforeach

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"feed_url": "http://localhost/feedBaseUrl/feed1.json",
"language": "en-US",
"icon": "http://localhost/image.jpg",
"authors": [{
"name": "feedItemAuthor"
}
],
"items": [{
"id": "http://localhost/1",
"title": "feedItemTitle",
Expand Down

0 comments on commit e879dce

Please sign in to comment.