1

Creating an RSS feed in craft and I have it to loop through all the entries via:

    {% set sermons = craft.entries.section('sermonEntry').limit(null).find() %}
    {% for sermon in sermons %}

On my feed url (example.com/feed) I can only see 17 of my entries. However when I view the page source. I see all of my entries in XML format (roughly 31 entries)

Anyone have an idea why this may be? Or if it will affect my podcasts that go to itunes?

I am not sure if there is a limitation on atom or rss with craft but I have seen 100's of entries on a rss feed page so maybe I am overlooking something?

Any help is appreciated. Thanks!

  • 1
    Are any of the entries disabled/turned off? Do any of the entries have expiration dates or are set to post in the future? – Ryan Sep 18 '17 at 2:18
  • Unfortunately not, I have all the entries paginated and displaying fine on example.com/sermons. – Garrett Sep 18 '17 at 16:30
1

I accidentally had loop inside of the description tag which strangely caused only 17 entries to post to the RSS feed. Below is an example of what was causing the issue:

<description><![CDATA[
  {% set speaker = craft.categories.group('speaker').relatedTo(entry).find() %}
  {% for name in speaker %}
  A Sermon from {{ entry.sermondate | date("l, F j, Y") }}: {{ entry.title }} by {{ name.title }}]]></description>
        <category>Podcasts</category>
        <category>Christianity</category>
        <author>{{ name.title }}</author>
        <itunes:explicit>No</itunes:explicit>
        <itunes:author>{{ name.title }}</itunes:author>{% endfor %}

After I set it outside the Description tag if gave me all my entries on the RSS feed. Here is my final feed code:

    <?xml version="1.0" encoding="utf-8"?>
    <rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
    <channel>
    <title>Sermons at Example Church</title>
    <atom:link href="{{ url() }}" rel="self" type="application/rss+xml" />
    <link>http://www.examplechurch.org/sermons/</link>
    <description>Weekly morning sermons from Example Church in Sab Diego, CA. For all of our sermon archives, please visit http://www.example.org/sermons.</description>
    <lastBuildDate>Sun, 17 Sep 2017 00:00:00 -0600</lastBuildDate>
    <language>en-us</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <itunes:author>Example Church</itunes:author>
    <itunes:summary>Weekly morning sermons from Example Church in Sab Diego, CA. For all of our sermon archives, please visit http://www.example.org/sermons.</itunes:summary>
    <itunes:owner>
      <itunes:name>Example Church - San Diego, California</itunes:name>
      <itunes:email>web@examplechurch.org</itunes:email>
    </itunes:owner>
    <itunes:explicit>No</itunes:explicit>
    <itunes:category text="Religion &amp; Spirituality">
    <itunes:category text="Christianity"></itunes:category>
    </itunes:category>
    <itunes:category text="Health"></itunes:category>
    <itunes:category text="Society &amp; Culture"></itunes:category>
     {% if podcastImage.podcastimage|length %}
    <itunes:image href="{{ podcastImage.podcastimage.first.getUrl() }}"></itunes:image>
     {% endif %}
    {% set entries = craft.entries.section('sermonEntry').limit(null).find() %}
     {% for entry in entries %}
    <item>
      <title>{{ entry.title }}</title>
      <link>{{ entry.url }}</link>
      <pubDate>{{ entry.postDate.rss }}</pubDate>
       {% set audio = entry.audio.first() %}
       {% if audio %}
      <enclosure url="{{ audio.url }}" type="audio/mp3"></enclosure>
       {% endif %}
      <guid>{{ entry.url }}</guid>
       {% set speaker = craft.categories.group('speaker').relatedTo(entry).find() %}
      {% for name in speaker %}
      <description><![CDATA[A Sermon from {{ entry.sermondate | date("l, F j, Y") }}: {{ entry.title }} by {{ name.title }}]]></description>
      <category>Podcasts</category>
      <category>Christianity</category>
      <author>{{ name.title }}</author>
      <itunes:explicit>No</itunes:explicit>
      <itunes:author>{{ name.title }}</itunes:author>{% endfor %}
      <itunes:keywords>Example Church,Sermons,Christianity,Jesus Christ,Bible Teaching,Discipleship,Service</itunes:keywords>
     </item>
     {% endfor %}
   </channel>
   </rss>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.