Skip to main content

Displaying list of endorsements which are not featured

I'm working on a custom template for my endorsements page. I want the featured endorsements to show in a list at the top, and the non-featured endorsements to show below that. Here is the code I am trying to use:

{% raw }

{% for endorsement in page.endorsement.featured_endorsements } {% if endorsement.is_organization? }

{{ endorsement.signup.employer }} - {{ endorsement.signup.published_name_linked }}, {{ endorsement.signup.occupation }}
{{ endorsement.content }}

{% else }

{{ endorsement.signup.published_name_linked }}
{{ endorsement.content }}

{% endif } {% endfor } {% for endorsement in page.endorsement.endorsements } {% if endorsement.is_organization? }

{{ endorsement.signup.employer }} - {{ endorsement.signup.published_name_linked }}, {{ endorsement.signup.occupation }}
{{ endorsement.content }}

{% elsif endorsement.is_featured? } {% else }

{{ endorsement.signup.published_name_linked }}
{{ endorsement.content }}

{% endif } {% endfor }

{% endraw }

The problem is with the elsif statement in the second half. You can see that it is an empty elsif, because if the endorsement is featured I don't want anything to be displayed. However, it isn't working. All endorsements are displayed, so featured endorsements end up being displayed twice. What am I doing wrong?

Official response from

Matthew:

If you just want to list the Endorsements, the liquid would look something like this.

{% raw %}

<div class="padtop"><h4>Featured Endorsements</h4></div>
<div class="padtop">
{% for endorsement in page.endorsement.featured_endorsements %}
{% if endorsement.is_organization? %}
{{ endorsement.signup.employer }} - {{ endorsement.signup.published_name_linked }}, {{ endorsement.signup.occupation }}
{% else %}
{{ endorsement.signup.published_name_linked }}
{% endif %}
{% endfor %}
</div>

<div class="padtop"><h4>Endorsements</h4></div>

<div class="padtop">
{% for endorsement in page.endorsement.endorsements %}
{% if endorsement.is_organization? %}
{{ endorsement.signup.employer }} - {{ endorsement.signup.published_name_linked }}, {{ endorsement.signup.occupation }}
{% else %}
{{ endorsement.signup.published_name_linked }}
{% endif %}
{% endfor %}
</div>

{% endraw %}

------

That would generate a list of Endorsements for both featured and regular entries.  

Share this post

Showing 9 reactions

Please check your e-mail for a link to activate your account.