CMS Development

ingramleedy
Contributor

Custom Blog Post Template - Optimize Word Count Incorrect

SOLVE

Hi.  I am working on a customzied blog template that inserts CTAs automatically in blog content.  It's based loosely on another post here, 

 

https://community.hubspot.com/t5/CMS-Development/HubL-coding-in-a-blog-template-to-insert-a-line-of-...

 

It works great!  However, when I edit the post and go to the optimize page it shows that the Word count of whats in the Title vs what is in the content.post_body.   When I render the new content out, render out what in in content.post_body, but when I encounter a paragraph break I insert CTA code after so many paragraphs.  

On a side note, it seems that this would be a good feature for Hubspot to have some kind of management system for blog posts, as I dont want to go thru all my blog posts and change out custom inserted CTAs.  This was an easy way to add them across all assets if I am running an offer or something.    

I dont know if I am missing some kinda of tag or ID that the optimize is using.  The variabe content.post_body contains all the content it should be counting.  


Any feedback is welcomed.   Am I missing something?

-Ingram

0 Upvotes
1 Accepted solution
ingramleedy
Solution
Contributor

Custom Blog Post Template - Optimize Word Count Incorrect

SOLVE

Solved.

 

Looks like the blog posts have to be wrapped in this class to be counted correctly.

 

<div class="blog-post-wrapper cell-wrapper">

View solution in original post

0 Upvotes
2 Replies 2
ingramleedy
Solution
Contributor

Custom Blog Post Template - Optimize Word Count Incorrect

SOLVE

Solved.

 

Looks like the blog posts have to be wrapped in this class to be counted correctly.

 

<div class="blog-post-wrapper cell-wrapper">

0 Upvotes
jennysowyrda
Community Manager
Community Manager

Custom Blog Post Template - Optimize Word Count Incorrect

SOLVE

Thank you for sharing your solution @ingramleedy!

0 Upvotes