tojson filter in a JavaScript file


I've been working on building a resources overview page for my company's website, and the best way I could find to do this with all of the functionality that our team requested was to create a new blog for each resource type (videos, webinars, infographics, etc. all needed to be clearly differentiated). I wanted to build a searchable page that doesn't refresh and filter based on the url query string, since the refresh isn't a smooth user experience. Since we don't have all that many resources, I was wanting to load them all at once, then filter them based on user input just using javascript. I originally had something along the lines of:
const resources = {

  videos: {{ blog_recent_posts(id)|asjson }},

  webinars: {{ blog_recent_posts(id)|asjson }},



And then I used jquery to build cards based on the information that I got here. But we noticed that the posts were not reflecting changes in titles or even new posts being added -- it reflected whatever the state of the blogs were the last time that I published my code. I reached out to support, and I was told "due to the fact that this page is rendering your content using Javascript, this is out of our scope of what we can support. The best approach here would be to manually adjust the titles of the content everywhere they appear unfortunately." 

So does anyone have an idea why it would not refresh until I re-publish? I assume that it's because the information from the blog_recent_posts method is pulled in and converted to json at time of publish rather than at load time, but this doesn't make much sense. Also, is there any way to do what I described in the beginning of the post? All that I can find are posts about how to create a searchable blog that only searches on refresh. 

1 Reply 1
HubSpot Employee

Hi, @prestonW.


Apologies for the delayed response.


Before digging into the blog refresh behavior too deeply, may I ask whether you've considered HubDB? It seems like it may be a better fit for your use case than the blog tool, but let me know if I've overlooked some consideration.

Isaac Takushi

Associate Certification Manager