Thanks for looking into this post! I am super new to Statamic, just got a license and thought it would be smart to start with v3 right away. My php skills are really limited I guess. So I was trying to get a mini podcast website up including the feed for it. And that is where things did not work anymore.
What I have
- a clean v3 install latest version / beta38
- a few simple templates, blueprints, and layouts
- two routes
resources/routes/web.php
<?php
use Illuminate\Support\Facades\Route;
Route::statamic('episodes', 'episodes/index');
Route::statamic('podcastfeed', 'episodes/feed', [
'layout' => 'rss' ,
'content_type' => 'atom']
);
?>
resources/blueprints/episode.yaml
title: Episode
sections:
main:
display: Main
fields:
-
handle: episode_subtitle
field:
input_type: text
type: text
localizable: false
listable: hidden
display: Subtitle
-
handle: episode_cover
field:
mode: grid
restrict: false
allow_uploads: true
max_files: 1
type: assets
localizable: false
listable: hidden
display: Cover
-
handle: episode_language
field:
options:
de: 'German'
en: 'English'
inline: true
type: radio
localizable: false
listable: hidden
display: Language
-
handle: episode_season
field:
type: integer
localizable: false
listable: hidden
display: Season
width: 33
-
handle: episode_number
field:
type: integer
localizable: false
listable: hidden
display: Episode
width: 33
-
handle: episode_length
field:
input_type: number
type: text
instructions: 'In seconds'
localizable: false
listable: hidden
display: Length
width: 33
-
handle: episode_recording_date
field:
mode: single
time_enabled: false
time_required: false
earliest_date: '2020-07-01'
full_width: false
inline: true
columns: 1
rows: 1
type: date
localizable: false
listable: hidden
display: 'Recording date'
-
handle: episode_mp3_url
field:
type: link
localizable: false
listable: hidden
display: 'MP3 URL'
content:
display: Content
fields:
-
handle: episode_intro
field:
type: textarea
localizable: false
listable: hidden
display: Intro
-
handle: episode_shownotes
field:
buttons:
- h2
- h3
- bold
- unorderedlist
- orderedlist
- removeformat
- quote
- anchor
- image
save_html: false
toolbar_mode: fixed
link_noopener: false
link_noreferrer: false
target_blank: false
reading_time: false
fullscreen: true
allow_source: true
type: bard
localizable: false
listable: hidden
display: Shownotes
content/collections/episodes.yaml
title: Episodes
amp: true
template: episodes/show
layout: layout
blueprints:
- episode
revisions: false
route: '/episodes/s-{episode_season}-e-{episode_number}-{slug}'
date: true
sort_dir: asc
date_behavior:
past: public
future: private
resources/views/episodes/index.antlers.html
<h1>
Podcast-Episodes
</h1>
{{ content }}
<div>
<h3>
Season 1, 2, 3
</h3>
<ul>
{{ collection:episodes sort="episode_season:desc"
}}
<li>
<a href="{{ url }}">{{ title }} s {{ episode_season}} e {{episode_number}}</a>
</li>
{{ /collection:episodes }}
</ul>
</div>
resources/views/episodes/show.antlers.html
<span class="number">
Season {{ episode_season }} · Episode {{ episode_number }}
</span>
<h1>
{{ title }}
</h1>
<span class="language language-{{ episode_language }}"></span>
<p class="intro">
{{ episode_subtitle}}
</p>
<figure>
{{ episode_cover }}
<img src="{{ url }}" alt="{{ alt }}" width=200>
{{ /episode_cover }}
</figure>
<p class="date">
Recording date: {{ episode_recording_date }} · Duration: {{ episode_length }}
</p>
<p class="intro">
{{ episode_intro }}
</p>
<div class="shownotes">
{{ episode_shownotes}}
</div>
resources/views/episodes/feed.antlers.html
<rss version="2.0">
<channel>
{{ get_content from="/episodes" }}
<title>{{ title | cdata }}</title>
<link>{{ site_url }}</link>
<description>{{ content | cdata }}</description>
{{ /get_content }}
<lastBuildDate>{{ collection:episodes limit="1" }}{{ date format="r" }}{{ /collection:episodes }}</lastBuildDate>
<language>en-us</language>
<copyright>Copyright {{ current_date format='Y' }}</copyright>
<ttl>3600</ttl>
{{ collection:episodes }}
<item>
<title>{{ title | cdata }}</title>
<link>{{ permalink }}</link>
<guid>{{ permalink }}</guid>
<pubDate>{{ date format="r" }}</pubDate>
<description>{{ content | full_urls | cdata }}</description>
</item>
{{ /collection:episodes }}
</channel>
</rss>
resources/views/rss.antlers.html
{{ xml_header }}
{{ layout_content }}
Now, calling the index at /episodes works fine. A click on the episode opens the detail view as well. Nice. But the feed is giving me a hard time. On the forum I found an example but that is v2 code and since routes etc. have changed a bit I am sure I am missing something here.
Now when I request /podcastfeed in the browser I get
ErrorException array_merge(): Expected parameter 1 to be an array, null given
I am not sure which other data to share to help understanding this. Just let me know and I will try to fill in any gaps.
Environment information
- Laravel version = 7.20.0
- Laravel locale = en
- Laravel config cached = false
- PHP version = 7.4.1
Maybe you can help me and point me at any resource or where I am totally missing what is going on. The lack of a demo for v3 and a working feed in it makes it hard to understand and work based on it.
Maybe the https://www.youtube.com/watch?v=-cLzCWu-DeE / https://github.com/statamic/starter-kit-doogie-browser could use a feed template to learn how v3 needs things served up.
Really appreciate any help or pointing in the right direction. Thanks a bunch :)