<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using blog_recent_topic_posts() to Exclude Current Post in Returned Results in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Using-blog-recent-topic-posts-to-Exclude-Current-Post-in/m-p/507877#M25477</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a recent posts module for the bottom of my blog to pull in the three most recent posts from the same topic as the present post.&amp;nbsp; I like the way it's working, but... the first post is the current post.&lt;BR /&gt;&lt;BR /&gt;So is there a way to add in an offset to take posts #2, #3 and #4 and/or exlcude the current post?&lt;BR /&gt;&lt;BR /&gt;Here's the gist of the module:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set number_of_posts = 3 %}
{% set posts = blog_recent_topic_posts("default", content.topic_list[0].slug, 3) %}
{% if module.specific_tag_topic %}
	{% set posts = blog_recent_topic_posts(module.choose_blog, module.tag, number_of_posts) %}
{% endif %}

&amp;lt;section class="blog-feed"&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;h2&amp;gt;
      Related Reading
    &amp;lt;/h2&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="blog-posts"&amp;gt;
    {% for post in posts %}
    &amp;lt;div class="blog-post"&amp;gt;
      &amp;lt;div class="ni-post blog-post-inner"&amp;gt;
        &amp;lt;div class="blog-post-image" style="background-image: url({{ resize_image_url( post.featured_image,0,350 ) }});"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="blog-post-content-wrapper"&amp;gt;
          &amp;lt;a class="blog-post-title" href="{{ post.absolute_url }}"&amp;gt;&amp;lt;h3&amp;gt;{{ post.name }}&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;
          &amp;lt;a class="blog-post-read-more" href="{{ post.absolute_url }}"&amp;gt;Read More &amp;amp;rarr;&amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    {% endfor %}
  &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 08 Oct 2021 17:52:43 GMT</pubDate>
    <dc:creator>CFrench</dc:creator>
    <dc:date>2021-10-08T17:52:43Z</dc:date>
    <item>
      <title>Using blog_recent_topic_posts() to Exclude Current Post in Returned Results</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-blog-recent-topic-posts-to-Exclude-Current-Post-in/m-p/507877#M25477</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a recent posts module for the bottom of my blog to pull in the three most recent posts from the same topic as the present post.&amp;nbsp; I like the way it's working, but... the first post is the current post.&lt;BR /&gt;&lt;BR /&gt;So is there a way to add in an offset to take posts #2, #3 and #4 and/or exlcude the current post?&lt;BR /&gt;&lt;BR /&gt;Here's the gist of the module:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set number_of_posts = 3 %}
{% set posts = blog_recent_topic_posts("default", content.topic_list[0].slug, 3) %}
{% if module.specific_tag_topic %}
	{% set posts = blog_recent_topic_posts(module.choose_blog, module.tag, number_of_posts) %}
{% endif %}

&amp;lt;section class="blog-feed"&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;h2&amp;gt;
      Related Reading
    &amp;lt;/h2&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="blog-posts"&amp;gt;
    {% for post in posts %}
    &amp;lt;div class="blog-post"&amp;gt;
      &amp;lt;div class="ni-post blog-post-inner"&amp;gt;
        &amp;lt;div class="blog-post-image" style="background-image: url({{ resize_image_url( post.featured_image,0,350 ) }});"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="blog-post-content-wrapper"&amp;gt;
          &amp;lt;a class="blog-post-title" href="{{ post.absolute_url }}"&amp;gt;&amp;lt;h3&amp;gt;{{ post.name }}&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;
          &amp;lt;a class="blog-post-read-more" href="{{ post.absolute_url }}"&amp;gt;Read More &amp;amp;rarr;&amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    {% endfor %}
  &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 08 Oct 2021 17:52:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-blog-recent-topic-posts-to-Exclude-Current-Post-in/m-p/507877#M25477</guid>
      <dc:creator>CFrench</dc:creator>
      <dc:date>2021-10-08T17:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using blog_recent_topic_posts() to Exclude Current Post in Returned Results</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-blog-recent-topic-posts-to-Exclude-Current-Post-in/m-p/508016#M25488</link>
      <description>&lt;P&gt;If you fetch 4 posts instead of 3, you can use an if statement to filter out the current post using the name of the post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{% if post.name != content.name %}&lt;/P&gt;</description>
      <pubDate>Sat, 09 Oct 2021 08:00:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-blog-recent-topic-posts-to-Exclude-Current-Post-in/m-p/508016#M25488</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2021-10-09T08:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using blog_recent_topic_posts() to Exclude Current Post in Returned Results</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-blog-recent-topic-posts-to-Exclude-Current-Post-in/m-p/508186#M25492</link>
      <description>&lt;P&gt;Similar to what&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;&amp;nbsp;said but instead of doing content.name you do a range. Below should work.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set number_of_posts = 3 %}
{% set posts = blog_recent_topic_posts("default", content.topic_list[0].slug, 4) %}
{% if module.specific_tag_topic %}
	{% set posts = blog_recent_topic_posts(module.choose_blog, module.tag, number_of_posts) %}
{% endif %}

&amp;lt;section class="blog-feed"&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;h2&amp;gt;
      Related Reading
    &amp;lt;/h2&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="blog-posts"&amp;gt;
    {% for post in posts %}
    {% if loop.index in range(2,99) %}
    &amp;lt;div class="blog-post"&amp;gt;
      &amp;lt;div class="ni-post blog-post-inner"&amp;gt;
        &amp;lt;div class="blog-post-image" style="background-image: url({{ resize_image_url( post.featured_image,0,350 ) }});"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="blog-post-content-wrapper"&amp;gt;
          &amp;lt;a class="blog-post-title" href="{{ post.absolute_url }}"&amp;gt;&amp;lt;h3&amp;gt;{{ post.name }}&amp;lt;/h3&amp;gt;&amp;lt;/a&amp;gt;
          &amp;lt;a class="blog-post-read-more" href="{{ post.absolute_url }}"&amp;gt;Read More &amp;amp;rarr;&amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    {% endif %}
    {% endfor %}
  &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 07:02:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-blog-recent-topic-posts-to-Exclude-Current-Post-in/m-p/508186#M25492</guid>
      <dc:creator>erod</dc:creator>
      <dc:date>2021-10-10T07:02:24Z</dc:date>
    </item>
  </channel>
</rss>

