# Feed is not generating properly

**URL:** <https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632>\
**Category:** Help\
**Created:** [February 13, 2019, 9:27am UTC](https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632 "2019-02-13T09:27:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [February 13, 2019, 9:27am UTC](https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632/1 "2019-02-13T09:27:37Z")

</div>

The image you can see below it is only showing 10 entries whereas on the site there is more than 300 posts.

Link to feed: [https://blog.codecarrot.net/feed.xml](https://blog.codecarrot.net/feed.xml)

![image](https://canada1.discourse-cdn.com/flex030/uploads/jekyllrb/original/2X/6/6cf5fee102d7a689b07cc64cac1c16a7c5a07e51.png)

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [February 13, 2019, 1:57pm UTC](https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632/2 "2019-02-13T13:57:27Z")

</div>

You didn’t mention it, but I’m guessing you’re using the **[jekyll-feed](https://github.com/jekyll/jekyll-feed)** plugin.  
In that case they [limit the post `for` loop to `10`](https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/feed.xml#L46). That’s why you’re not seeing all posts.

This is typical of RSS/Atom feeds. A sitemap on the other hand lists all posts and pages.

---

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [February 13, 2019, 2:36pm UTC](https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632/3 "2019-02-13T14:36:13Z")

</div>

So, to show all the posts in RSS feed, do I need to remove `jekyll-feed` plugin.

And if I remove that plugin will jekyll auto generate the RSS feed.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [February 13, 2019, 2:49pm UTC](https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632/4 "2019-02-13T14:49:19Z")

</div>

That plugin generates your RSS feed, if you remove it you’ll remove the feeds too.  
To my knowledge jekyll-feed doesn’t allow you to change `limit: 10` to something else.

They need to either add that feature in, or you stop using the plugin and create your own feed. Creating your own feed isn’t that hard, you can just copy their feed template and turn it into a `_layout` and then build as you would any other page.

> <https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/feed.xml>

---

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [February 13, 2019, 8:12pm UTC](https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632/5 "2019-02-13T20:12:26Z")

</div>

I have just getting this error

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/jekyllrb/original/2X/b/bb8f8b0ef2909af4f8218d169633546b1d16cf76.png)

I tried the follow code in a filename `feed.xml` which is at the root of the project. I have copied the same code from [https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/feed.xml](https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/feed.xml)

```xml
---
layout: null
---

<?xml version="1.0" encoding="utf-8"?>
{% if page.xsl %}
  <?xml-stylesheet type="text/xml" href="{{ '/feed.xslt.xml' | absolute_url }}"?>
{% endif %}
<feed xmlns="http://www.w3.org/2005/Atom" {% if site.lang %}xml:lang="{{ site.lang }}"{% endif %}>
  <generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
  <link href="{{ page.url | absolute_url }}" rel="self" type="application/atom+xml" />
  <link href="{{ '/' | absolute_url }}" rel="alternate" type="text/html" {% if site.lang %}hreflang="{{ site.lang }}" {% endif %}/>
  <updated>{{ site.time | date_to_xmlschema }}</updated>
  <id>{{ page.url | absolute_url | xml_escape }}</id>

  {% assign title = site.title | default: site.name %}
  {% if page.collection != "posts" %}
    {% assign collection = page.collection | capitalize %}
    {% assign title = title | append: " | " | append: collection %}
  {% endif %}
  {% if page.category %}
    {% assign category = page.category | capitalize %}
    {% assign title = title | append: " | " | append: category %}
  {% endif %}

  {% if title %}
    <title type="html">{{ title | smartify | xml_escape }}</title>
  {% endif %}

  {% if site.description %}
    <subtitle>{{ site.description | xml_escape }}</subtitle>
  {% endif %}

  {% if site.author %}
    <author>
        <name>{{ site.author.name | default: site.author | xml_escape }}</name>
      {% if site.author.email %}
        <email>{{ site.author.email | xml_escape }}</email>
      {% endif %}
      {% if site.author.uri %}
        <uri>{{ site.author.uri | xml_escape }}</uri>
      {% endif %}
    </author>
  {% endif %}

  {% assign posts = site[page.collection] | where_exp: "post", "post.draft != true" | sort: "date" | reverse %}
  {% if page.category %}
    {% assign posts = posts | where: "category",page.category %}
  {% endif %}
  {% for post in posts limit: 10 %}
    <entry{% if post.lang %}{{" "}}xml:lang="{{ post.lang }}"{% endif %}>
      <title type="html">{{ post.title | smartify | strip_html | normalize_whitespace | xml_escape }}</title>
      <link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post.title | xml_escape }}" />
      <published>{{ post.date | date_to_xmlschema }}</published>
      <updated>{{ post.last_modified_at | default: post.date | date_to_xmlschema }}</updated>
      <id>{{ post.id | absolute_url | xml_escape }}</id>
      <content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">{{ post.content | strip | xml_escape }}</content>

      {% assign post_author = post.author | default: post.authors[0] | default: site.author %}
      {% assign post_author = site.data.authors[post_author] | default: post_author %}
      {% assign post_author_email = post_author.email | default: nil %}
      {% assign post_author_uri = post_author.uri | default: nil %}
      {% assign post_author_name = post_author.name | default: post_author %}

      <author>
          <name>{{ post_author_name | default: "" | xml_escape }}</name>
        {% if post_author_email %}
          <email>{{ post_author_email | xml_escape }}</email>
        {% endif %}
        {% if post_author_uri %}
          <uri>{{ post_author_uri | xml_escape }}</uri>
        {% endif %}
      </author>

      {% if post.category %}
        <category term="{{ post.category | xml_escape }}" />
      {% endif %}

      {% for tag in post.tags %}
        <category term="{{ tag | xml_escape }}" />
      {% endfor %}

      {% if post.excerpt and post.excerpt != empty %}
        <summary type="html">{{ post.excerpt | strip_html | normalize_whitespace | xml_escape }}</summary>
      {% endif %}

      {% assign post_image = post.image.path | default: post.image %}
      {% if post_image %}
        {% unless post_image contains "://" %}
          {% assign post_image = post_image | absolute_url %}
        {% endunless %}
        <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ post_image | xml_escape }}" />
      {% endif %}
    </entry>
  {% endfor %}
</feed>

```

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [February 14, 2019, 7:46am UTC](https://talk.jekyllrb.com/t/feed-is-not-generating-properly/2632/6 "2019-02-14T07:46:01Z")

</div>

Liquid is choking at the following line:

```auto
{% assign posts = site[page.collection] | where_exp: "post", "post.draft != true" | sort: "date" | reverse %}

```

Add the following to your feed-template’s front matter:

```auto
collection: posts

```

When copying `jekyll-feed`'s template, keep in mind that every instance of `page.something` is referring to the variable `something` in the template’s front matter data hash.  
Jekyll Feed sets all the variables internally. So you wont see them in the template explicitly.
