<p>You could try this</p>

<pre><code>{% set featured = craft.entries.section('blog').featured(1).count() %}
{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}
{% for index, entry in entriesOnPage %}
    {# entry is featured or it's the first entry and there are no other
    featured entries #}
    {% if entry.featured or (index == 0 and featured == 0) %}
        [markup A]
    {% else %}
        [markup B excluding featured item]
    {% endif %}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2018-04-09T15:09:24.133Z
2018-04-09T15:09:24.133Z
Robin Schambach
<p>Based on the docs of the lightswitch field can't you just to this? </p>

<pre><code>{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}
{% for entry in entriesOnPage %}
{% if entry.featured or loop.first and not entry.featured %}

This entry is featured. 

{% else %}

Entry isnt featured

{% endif %}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2018-04-09T15:10:23.160Z
2018-04-09T15:10:23.160Z
Gįëł Tėttëłæår
<p>I'm trying to include different markup if a blog post is featured.
This is done via a Lightswitch. If there's is no featured entry then the latest entry uses this different markup instead.
The rest of the entries follow this but need to exclude showing the featured entry if it is shown above.</p>

<p>This is something like what I'm trying to achieve </p>

<pre><code>{% set featured = craft.entries.section('blog').featured(1).limit(1) %}
{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}
{% for entry in entriesOnPage %}
    {% if entry is featured or loop.first and not featured|length %}

       [markup A]

    {% else %}

       [markup B excluding featured item]

    {% endif %}
{% endfor %}
</code></pre>

<loop><lightswitch>
If featured or latest entry
# If featured or latest entry

(Asked by: username_0 on 2018-04-09)

I'm trying to include different markup if a blog post is featured.
This is done via a Lightswitch. If there's is no featured entry then the latest entry uses this different markup instead.
The rest of the entries follow this but need to exclude showing the featured entry if it is shown above.
This is something like what I'm trying to achieve 
{% set featured = craft.entries.section('blog').featured(1).limit(1) %}
{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}
{% for entry in entriesOnPage %}
    {% if entry is featured or loop.first and not featured|length %}

       [markup A]

    {% else %}

       [markup B excluding featured item]

    {% endif %}
{% endfor %}

**Tags:** loop, lightswitch


---

## 2 answers

### Answer by username_1 on 2018-04-09. Score: 1

You could try this
{% set featured = craft.entries.section('blog').featured(1).count() %}
{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}
{% for index, entry in entriesOnPage %}
    {# entry is featured or it's the first entry and there are no other
    featured entries #}
    {% if entry.featured or (index == 0 and featured == 0) %}
        [markup A]
    {% else %}
        [markup B excluding featured item]
    {% endif %}
{% endfor %}


---

### Answer by username_2 on 2018-04-09. Score: 0

Based on the docs of the lightswitch field can't you just to this? 
{% paginate craft.entries.section('blog').limit(12) as entriesOnPage %}
{% for entry in entriesOnPage %}
{% if entry.featured or loop.first and not entry.featured %}

This entry is featured. 

{% else %}

Entry isnt featured

{% endif %}
{% endfor %}


---

