<p>You'd have to add a conditional and render the featured entry on the first paginated page only. You can access that info from the <a href="https://craftcms.com/docs/templating/paginate#the-pageInfo-variable" rel="nofollow">pageInfo</a> variable.</p>

<p>Another thing I'd do is to remove the featured entry from the all entries criteria model by prepending the ID with 'not' in the <code>id</code> param (i.e. <code>id('not 72')</code>). You can probably reduce the amount of database queries with that change.</p>

<pre><code>{# Get the featured entry #}
{% set featuredEntry = craft.entries.section('news').type('article').first() %}

{# Get all other entries #}
{% set idParam = 'not ' ~ featuredEntry.id %}
{% set entries = craft.entries.section('news').id(idParam) %}

{% paginate entries.limit(10) as pageInfo, pageEntries %}

{# Render the featured entry for the first page only #}
{% if pageInfo.currentPage == 1 %}
    {% include '/partials/_featuredArticleTemplate' with {
        entry: featuredEntry
    } %}
{% endif %}

{# Render all the other entries #}
{% for entry in pageEntries %}
    {# include partial #}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2016-03-29T21:22:14.003Z
Way more elegant than the way I was doing it, and works flawlessly! Thank you so much!
Doug Hahn
CC BY-SA 3.0
2016-03-29T21:03:56.503Z
2016-03-29T21:03:56.503Z
carlcs
<p>Any help here would be appreciated… I feel like this is really close. </p>

<p>I have 4 entry types, all of which are shown in a blog index:</p>

<ol>
<li>Article</li>
<li>Video</li>
<li>Image</li>
<li>Blurb</li>
</ol>

<p>The most recent entry of the Article type should always be shown as a "featured article" at the top of the page and never repeated again; all the other entry types should appear below this single featured entry in chronological order. The featured article should only appear on the first page of the index, and never appear on subsequent "pages" because this page also uses infinite scroll. </p>

<p>The problem is that the featured article shows up again on all pages past the first. When I remove pagination, but use the same <code>nonFeaturedIds</code> parameter to get my entries, everything works perfectly. </p>

<p>In other words, it seems that the "featured article," is not properly being excluded from Pagination by the entry paramaters I've set up.</p>

<p>Thank you!</p>

<pre><code>{# Define a variable for all the post types #}
  {% set allIds = craft.entries.section('news').ids() %}
{# Define a variable for the featured article: the first occurance of the article entry type #}
  {% set featuredId = craft.entries.type('article').limit('1').ids() %}
{# Define all other entries and entry types as non featured #}
  {% set nonFeaturedIds = allIds|without(featuredId) %}

{# Get the featured entry #}
  {% for entry in craft.entries.id(featuredId) %}
    {% include '/partials/_featuredArticleTemplate' %}
  {% endfor %}

{# set paramaters on an elementCriteriaModel to get all non featured articles and paginate #}
  {% set entries = craft.entries.id(nonFeaturedIds) %}
  {% paginate entries.limit(10) as pageCount, nonfeatured %}

{# Take us to 404 if the page doesn't exist. Otherwise, Infinite scroll keeps repeating the last page of content. #}
  {% if craft.request.getPageNum() &gt; pageCount.totalPages %}
    {% exit 404 %}
  {% endif %}

{# load up the templates for each entry type #}
  {% for entry in nonfeatured %}
    {# all the other articles #}
    {% switch entry.type %} 
      {% case "article" %}
          {% include '/partials/_articleTemplate' %}
      {% case "video" %}
        {% include '/partials/_videoTemplate' %}
      {% case "image" %}
        {% include '/partials/_imageTemplate' %}
      {% case "blurb" %}
        {% include '/partials/_blurbTemplate' %}
      {% default %}
    {% endswitch %}
  {% endfor %}

{# infinite scroll loading area #}
  {% if pageCount.nextUrl %}
    {# pagination styles #}
  {% endif %}
</code></pre>

<elementcriteriamodel><pagination>
Excluding a single Entry ID of an Entry Type from craft.entries
# Excluding a single Entry ID of an Entry Type from craft.entries

(Asked by: username_0 on 2016-03-29)

Any help here would be appreciated… I feel like this is really close. 
I have 4 entry types, all of which are shown in a blog index:

Article
Video
Image
Blurb

The most recent entry of the Article type should always be shown as a "featured article" at the top of the page and never repeated again; all the other entry types should appear below this single featured entry in chronological order. The featured article should only appear on the first page of the index, and never appear on subsequent "pages" because this page also uses infinite scroll. 
The problem is that the featured article shows up again on all pages past the first. When I remove pagination, but use the same nonFeaturedIds parameter to get my entries, everything works perfectly. 
In other words, it seems that the "featured article," is not properly being excluded from Pagination by the entry paramaters I've set up.
Thank you!
{# Define a variable for all the post types #}
  {% set allIds = craft.entries.section('news').ids() %}
{# Define a variable for the featured article: the first occurance of the article entry type #}
  {% set featuredId = craft.entries.type('article').limit('1').ids() %}
{# Define all other entries and entry types as non featured #}
  {% set nonFeaturedIds = allIds|without(featuredId) %}

{# Get the featured entry #}
  {% for entry in craft.entries.id(featuredId) %}
    {% include '/partials/_featuredArticleTemplate' %}
  {% endfor %}

{# set paramaters on an elementCriteriaModel to get all non featured articles and paginate #}
  {% set entries = craft.entries.id(nonFeaturedIds) %}
  {% paginate entries.limit(10) as pageCount, nonfeatured %}

{# Take us to 404 if the page doesn't exist. Otherwise, Infinite scroll keeps repeating the last page of content. #}
  {% if craft.request.getPageNum() > pageCount.totalPages %}
    {% exit 404 %}
  {% endif %}

{# load up the templates for each entry type #}
  {% for entry in nonfeatured %}
    {# all the other articles #}
    {% switch entry.type %} 
      {% case "article" %}
          {% include '/partials/_articleTemplate' %}
      {% case "video" %}
        {% include '/partials/_videoTemplate' %}
      {% case "image" %}
        {% include '/partials/_imageTemplate' %}
      {% case "blurb" %}
        {% include '/partials/_blurbTemplate' %}
      {% default %}
    {% endswitch %}
  {% endfor %}

{# infinite scroll loading area #}
  {% if pageCount.nextUrl %}
    {# pagination styles #}
  {% endif %}

**Tags:** elementcriteriamodel, pagination

---

## 1 answers

### Answer by username_1 on 2016-03-29. Score: 4 | Accepted answer

You'd have to add a conditional and render the featured entry on the first paginated page only. You can access that info from the pageInfo variable.
Another thing I'd do is to remove the featured entry from the all entries criteria model by prepending the ID with 'not' in the id param (i.e. id('not 72')). You can probably reduce the amount of database queries with that change.
{# Get the featured entry #}
{% set featuredEntry = craft.entries.section('news').type('article').first() %}

{# Get all other entries #}
{% set idParam = 'not ' ~ featuredEntry.id %}
{% set entries = craft.entries.section('news').id(idParam) %}

{% paginate entries.limit(10) as pageInfo, pageEntries %}

{# Render the featured entry for the first page only #}
{% if pageInfo.currentPage == 1 %}
    {% include '/partials/_featuredArticleTemplate' with {
        entry: featuredEntry
    } %}
{% endif %}

{# Render all the other entries #}
{% for entry in pageEntries %}
    {# include partial #}
{% endfor %}

> **Comments:**
> **username_0**: Way more elegant than the way I was doing it, and works flawlessly! Thank you so much!  

---

