{% set posts = blog_recent_posts(‘default’, 5 ) %}
{% for post in posts %}
<div class=“blog-main”>
<div class=“feature-img-blogs”>
<p class=“icons”><a href=“{{ post.absolute_url }}”><img src=“{{ post.featured_image }}” alt=“{{ post.name }}”></a></p>
</div>
<div class=“post-name-blogs”>
<h3><a href=“{{ post.absolute_url }}”>{{ post.name }}</a></h3>
</div>
</div>
{% endfor %}
@bagha07, each item in the for loop has an index. the index starts at 1.
you can add an if statement that states if loop index is greater than 1, print.
i added to the code below
{% set posts = blog_recent_posts('default', 5 ) %}
{% for post in posts %}
{% if loop.index > 1 %}
<div class="blog-main">
<div class="feature-img-blogs">
<p class="icons"><a href="{{ post.absolute_url }}"><img src="{{ post.featured_image }}" alt="{{ post.name }}"></a></p>
</div>
<div class="post-name-blogs">
<h3><a href="{{ post.absolute_url }}">{{ post.name }}</a></h3>
</div>
</div>
{% endif %}
{% endfor %}
Hi dennis,
Thanks for your help!
Yes, It is working.
Hi there!
In my site’s home page the last blog post should appear as a main post (larger in size) followed by an RSS listing of the last 3 blog posts. I don’t want to have the latest post appear as the main post and then again at the beginning of the RSS feed. It seems this post is related to this, but I don’t know where I should include that code. This is the RSS listing code:
{% if module.rss_feed_type == “external” %}
{% set feed_source = “{is_external=True, rss_url='”~module.rss_url~“‘, content_group_id=’'}” %}
{% set is_external = true %}
{% elif module.rss_feed_type == “blog” %}
{% set feed_source = “{is_external=False, content_group_id='” ~ module.content_group_id ~ “‘, rss_url=’'}” %}
{% set is_external = false %}
{% endif %}
{% rss_listing
publish_date_text=“{{ module.publish_date_text }}”,
rss_url=“{{ module.rss_url }}”,
is_external=“{{ is_external }}”,
click_through_text=“{{ module.click_through_text }}”,
show_date=“{{ module.show_date }}”,
content_group_id=“{{ module.content_group_id }}”,
include_featured_image=“{{ module.include_featured_image }}”,
publish_date_format=“{{ module.publish_date_format }}”,
show_detail=“{{ module.show_detail }}”,
show_author=“{{ module.show_author }}”,
number_of_items=“{{ module.number_of_items }}”,
title=“{{ module.title }}”,
limit_to_chars=“{{ module.limit_to_chars }}”,
attribution_text=“{{ module.attribution_text }}”,
topic_id=“{{ module.topic_id }}”
feed_source=“{{ feed_source }}”
%}
Thank you in advance for any help!