<?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 Featured post in HubSpot blog in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/765888#M33190</link>
    <description>&lt;P&gt;Hello Developers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to show a featured post in HubSpot? My requirement is to highlight a post as a featured one which will not be changed automatically.&lt;/P&gt;&lt;P&gt;Actually I've used some HubL code before but it showed only the latest post as the featured post. So it'll be changed every time we add new posts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;BR /&gt;Shiyon&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2023 14:58:58 GMT</pubDate>
    <dc:creator>shiyon</dc:creator>
    <dc:date>2023-03-08T14:58:58Z</dc:date>
    <item>
      <title>Featured post in HubSpot blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/765888#M33190</link>
      <description>&lt;P&gt;Hello Developers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to show a featured post in HubSpot? My requirement is to highlight a post as a featured one which will not be changed automatically.&lt;/P&gt;&lt;P&gt;Actually I've used some HubL code before but it showed only the latest post as the featured post. So it'll be changed every time we add new posts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;BR /&gt;Shiyon&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 14:58:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/765888#M33190</guid>
      <dc:creator>shiyon</dc:creator>
      <dc:date>2023-03-08T14:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Featured post in HubSpot blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/766806#M33238</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/149772"&gt;@shiyon&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for reaching out. Let's see if we can get the conversation going. I know&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/61659"&gt;@Stephanie-OG&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/148115"&gt;@dbeau79&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/146956"&gt;@BarryGrennan&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/388114"&gt;@unicorndev&lt;/a&gt;&amp;nbsp;have posted about or replied to this topic in the past.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for taking a look! —Jaycee&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 22:14:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/766806#M33238</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-03-09T22:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Featured post in HubSpot blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/767105#M33253</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/149772"&gt;@shiyon&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The way I usually do this is to have a "featured" tag and then use the &lt;A href="https://developers.hubspot.com/docs/cms/hubl/functions#blog-recent-tag-posts" target="_blank" rel="noopener"&gt;&lt;CODE&gt;blog_recent_tag_posts&lt;/CODE&gt;&lt;/A&gt; function to get the latest post. If you just want one, you could do something like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set featured_posts = blog_recent_tag_posts("default", "featured", 1) %}

&amp;lt;div class="featured-post"&amp;gt;
  &amp;lt;h1&amp;gt;{{ featured_posts[0].name }}&amp;lt;/h1&amp;gt;
&amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above case you're setting the function to only get one post and then using the [0] index to fetch the first item on the list, but you could also use a loop like:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set featured_posts = blog_recent_tag_posts("default", "featured", 1) %}

{% for post in featured_posts %}
  &amp;lt;div class="featured-post"&amp;gt;
    &amp;lt;h1&amp;gt;{{ post.name }}&amp;lt;/h1&amp;gt;
  &amp;lt;/div&amp;gt;
{% endfor %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to code it to be a specific post without using a tag (since you mention you don't want it to be dynamic), you could also use the &lt;A href="https://developers.hubspot.com/docs/cms/hubl/functions#content-by-id" target="_blank" rel="noopener"&gt;&lt;CODE&gt;content_by_id&lt;/CODE&gt;&lt;/A&gt; function, like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set featured_post = content_by_id([[ content_id ]]) %}
  
&amp;lt;div class="featured-post"&amp;gt;
  &amp;lt;h1&amp;gt;{{ featured_post.title }}&amp;lt;/h1&amp;gt;
&amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you edit a post you'll find the content id in the URL, the structure is usually something like&amp;nbsp;&lt;A href="https://app.hubspot.com/blog/123/editor/456/content" target="_blank" rel="noopener"&gt;https://app.hubspot.com/blog/123/editor/456/content &lt;/A&gt;where 123 is the blog id and 456 the content id.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also have it be a field in a custom module by adding a "Page" field in a custom module.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that helps!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 14:28:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/767105#M33253</guid>
      <dc:creator>Stephanie-OG</dc:creator>
      <dc:date>2023-03-10T14:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Featured post in HubSpot blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/778457#M33653</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/61659"&gt;@Stephanie-OG&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the late reply.&lt;/P&gt;&lt;P&gt;Thank you for the detailed explanation. I think the last one is the code I needed. I tried it inside my blog and it worked. But I found some practical issues to implement it.&lt;/P&gt;&lt;P&gt;1) Actually, this feature is controlled by our client who is not familiar with editing the template.&lt;/P&gt;&lt;P&gt;2) Is there any method to help client to select the blog post as featured?&lt;/P&gt;&lt;P&gt;3) Then we also need to hide it from the remaining list.&lt;/P&gt;&lt;P&gt;4) Can you please explain how to use the custom module with the 'Page' field? I tried to add it but it returned the blog id + post title.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Shiyon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 16:17:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/778457#M33653</guid>
      <dc:creator>shiyon</dc:creator>
      <dc:date>2023-04-05T16:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Featured post in HubSpot blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/779679#M33715</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/61659"&gt;@Stephanie-OG&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a partial, but effective solution from your following blog:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.stephanieogaygarcia.com/hubspot-website-development/set-featured-posts-on-the-hubspot-blog-listings-page" target="_blank"&gt;https://www.stephanieogaygarcia.com/hubspot-website-development/set-featured-posts-on-the-hubspot-blog-listings-page&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I implemented the code, I was able to see the post which is tagged as 'featured', the exact feature I want, but only one post is appearing in the Second loop. Could you please check the code?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{# First loop: featured posts #}
  {% for content in contents %}
    {% for topic in content.topic_list %}
      {% if topic.name == 'featured' %}
        &amp;lt;div class="post-item"&amp;gt;
          {% if not simple_list_page %}
          &amp;lt;div class="post-header"&amp;gt;
            &amp;lt;h2&amp;gt;&amp;lt;a href="{{content.absolute_url}}"&amp;gt;{{ content.name }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div class="post-body clearfix"&amp;gt;
            &amp;lt;!--post summary--&amp;gt;
            {% if content.post_list_summary_featured_image %}
            &amp;lt;div class="hs-featured-image-wrapper"&amp;gt;
              &amp;lt;a href="{{content.absolute_url}}" title="" class="hs-featured-image-link"&amp;gt;
                &amp;lt;img loading="lazy"src="{{ content.post_list_summary_featured_image }}" class="hs-featured-image" alt="{{ content.featured_image_alt_text | escape }}"&amp;gt;
              &amp;lt;/a&amp;gt;
            &amp;lt;/div&amp;gt;
            {% endif %}
            {{ content.post_list_content|safe }}
          &amp;lt;/div&amp;gt;
          {% endif %}
        &amp;lt;/div&amp;gt;
      {% endif %}
    {% endfor %}
{% endfor %}

{# Second loop: all other posts #}
{% for content in contents %}
  {% for topic in content.topic_list %}
    {% if topic.name != 'featured' %}
      &amp;lt;h2&amp;gt;&amp;lt;a href="{{content.absolute_url}}"&amp;gt;{{ content.name }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
    {% endif %}
  {% endfor %}
{% endfor %}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Shiyon&lt;/P&gt;</description>
      <pubDate>Sun, 09 Apr 2023 10:50:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Featured-post-in-HubSpot-blog/m-p/779679#M33715</guid>
      <dc:creator>shiyon</dc:creator>
      <dc:date>2023-04-09T10:50:44Z</dc:date>
    </item>
  </channel>
</rss>

