<?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 HubL coding in a blog template to insert a line of text after a certain word count in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/53706#M3922</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am new to Hubspot and I need some ideas on how to approach a problem using HubL code with a blog template. I have been given the task to figure out a way to get a word count on a blog post and once a certain certain word count is achieved (lets say 150 words) a line of text will be inserted after that certain word count and then remaining&amp;nbsp;blog article text will be displayed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to edit the {{content.post_body}} with the HubL filters but I am not having much luck with the logic.&amp;nbsp; Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;Tommy&lt;/P&gt;</description>
    <pubDate>Tue, 28 Nov 2017 19:00:43 GMT</pubDate>
    <dc:creator>tommy</dc:creator>
    <dc:date>2017-11-28T19:00:43Z</dc:date>
    <item>
      <title>HubL coding in a blog template to insert a line of text after a certain word count</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/53706#M3922</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am new to Hubspot and I need some ideas on how to approach a problem using HubL code with a blog template. I have been given the task to figure out a way to get a word count on a blog post and once a certain certain word count is achieved (lets say 150 words) a line of text will be inserted after that certain word count and then remaining&amp;nbsp;blog article text will be displayed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to edit the {{content.post_body}} with the HubL filters but I am not having much luck with the logic.&amp;nbsp; Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;Tommy&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 19:00:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/53706#M3922</guid>
      <dc:creator>tommy</dc:creator>
      <dc:date>2017-11-28T19:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: HubL coding in a blog template to insert a line of text after a certain word count</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/54224#M3931</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/23308"&gt;@tommy&lt;/a&gt;,&amp;nbsp;you can achieve this task by two methods&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1)&amp;nbsp;Split out every word and append your line of text.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;here you need to&amp;nbsp;split out your post body into words after then you need to slice words&amp;nbsp; to your required word count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;{%  set words = content.post_body|split(' ', 10000)  %}
{% for column in words|slice(YOUR-WORD-COUNT,' ') %}
    {% for item in column %}
        {% if item %}
            {{ item }}
        {% endif %}
    {% endfor %}
    
    {% if loop.first %}
        &lt;SPAN&gt;Line of text to insert&lt;/SPAN&gt;
    {% endif %}
{% endfor %}&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2)&amp;nbsp; Add some tag to slice out article.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;this&amp;nbsp;example we used '&lt;STRONG&gt;&amp;lt;!--more--&amp;gt;&lt;/STRONG&gt;' (separator) to slice content as it&amp;nbsp;can directly set from edit post item and can set individually for each as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Separator&lt;/STRONG&gt; will be used to show some information on &lt;SPAN&gt;blog&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;listing page and&amp;nbsp;all information&amp;nbsp;on&amp;nbsp;blog posting page. for more info please refer&amp;nbsp;&lt;A title="here" href="https://knowledge.hubspot.com/articles/kcs_article/cos-blog/can-i-choose-where-my-read-more-tag-goes-in-my-cos-blog-post" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in below code article is divided based on separator position and then it shown with adding your custom text in between.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;{% set sections = content.post_body|split('&amp;lt;!--more--&amp;gt;', 2) %}
&amp;lt;div class="brief-summary"&amp;gt;
    {{  sections[0] }}
&amp;lt;/div&amp;gt;

&amp;lt;div&amp;gt;
    Line of text to insert
&amp;lt;/div&amp;gt;

&amp;lt;div class="detailed-summary"&amp;gt;
    {{  sections[1] }}
&amp;lt;/div&amp;gt;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We hope it&amp;nbsp;resolve your query.&lt;/P&gt;&lt;P&gt;Team TRooInbound!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 10:20:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/54224#M3931</guid>
      <dc:creator>TRooInbound</dc:creator>
      <dc:date>2017-11-29T10:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: HubL coding in a blog template to insert a line of text after a certain word count</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/54869#M3936</link>
      <description>&lt;P&gt;Great question and solutions!&amp;nbsp; &amp;nbsp;I really like this second solution that uses the &amp;lt;!--More--&amp;gt; tag.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this modified example I break the article into 3 parts (if available)&amp;nbsp; 3rd part made available from inserting a second &amp;lt;!--more--&amp;gt; tag.&amp;nbsp; &amp;nbsp; &amp;nbsp;This relies on the Author to add the second tag, but allows them to put the line of text in wherever they feel appropriate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{% set sections = content.post_body|split('&amp;lt;!--more--&amp;gt;', 3) %}
&amp;lt;div class="brief-summary"&amp;gt;
{{ sections[0] }}
&amp;lt;/div&amp;gt;

&amp;lt;div class="detailed-summary"&amp;gt;
{{ sections[1] }}
&amp;lt;/div&amp;gt;
{% if sections[2] %}
&amp;lt;div&amp;gt;
Line of Text
&amp;lt;/div&amp;gt;
&amp;lt;div&amp;gt;
{{ sections[2] }}
&amp;lt;/div&amp;gt;

{% endif %}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 18:43:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/54869#M3936</guid>
      <dc:creator>Christopher</dc:creator>
      <dc:date>2017-11-29T18:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: HubL coding in a blog template to insert a line of text after a certain word count</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/57277#M3964</link>
      <description>&lt;P&gt;Thanks you for your reply!!!!!&lt;/P&gt;&lt;P&gt;Both&amp;nbsp; your methods&amp;nbsp;solved&amp;nbsp;my task. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there any other extra resources about HubL coding (besides the basic overview documentation found on the Hubspot website) that you could recommend? I want to learn more&amp;nbsp;about HubL!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Tommy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 16:31:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/57277#M3964</guid>
      <dc:creator>tommy</dc:creator>
      <dc:date>2017-12-01T16:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: HubL coding in a blog template to insert a line of text after a certain word count</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/57283#M3965</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/23308"&gt;@tommy&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's&amp;nbsp;Great! Cool!&lt;/P&gt;&lt;P&gt;I don't think&amp;nbsp;so there is another document available for Hubl references.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you want to learn HubL code than just utilizing those available HubL filter and module in your project than&amp;nbsp;automatically.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly my above answer marking as a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did my post help answer your query? Help the Community by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;marking it as a solution.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Team TRooInbound&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 05:36:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-text-after-a/m-p/57283#M3965</guid>
      <dc:creator>TRooInbound</dc:creator>
      <dc:date>2017-12-02T05:36:36Z</dc:date>
    </item>
  </channel>
</rss>

