Hi all, I'm working on combining two hubspot blogs into one listing. I have got both blogs showing but I need to add javascript pagination as the standard Hubspot blog pagination doesn't support combined blog listings. Could anyone share example html and JS of how to implement this please? I have included the code for the listing that I'm working on. Thanks for any help.
<div class="blog-section">
<div class="blog-listing-wrapper cell-wrapper">
{# simple_list_page indicates the "blog/all" page, which is a list of links to every blog post #}
<div class="post-listing{% if simple_list_page %}-simple{% endif %}">
{% if blog_author %}
<div class="hs-author-profile">
<h2 class="hs-author-name">{{ blog_author.display_name }}</h2>
{% if blog_author.avatar %} <div class="hs-author-avatar"> <img width="35 px" src="{{ blog_author.avatar }}" loading="lazy" alt="{{ blog_author.display_name }}"> </div> {% endif %}
<div class="hs-author-bio">{{ blog_author.bio }}</div>
{% if blog_author.has_social_profiles %}
<div class="hs-author-social-section">
<span class="hs-author-social-label">Find me on:</span>
<div class="hs-author-social-links">
{% if blog_author.facebook %}
<a href="{{ blog_author.facebook }}" target="_blank" class="hs-author-social-link hs-social-facebook fa fa-facebook"><span class="hs-screen-reader-text">Facebook</span></a>
{% endif %}
{% if blog_author.linkedin %}
<a href="{{ blog_author.linkedin }}" target="_blank" class="hs-author-social-link hs-social-linkedin fa fa-linkedin-square"><span class="hs-screen-reader-text">Linkedin</span></a>
{% endif %}
{% if blog_author.twitter %}
<a href="{{ blog_author.twitter }}" target="_blank" class="hs-author-social-link hs-social-twitter fa fa-twitter-square"><span class="hs-screen-reader-text">Twitter</span></a>
{% endif %}
{% if blog_author.google_plus %}
<a href="{{ blog_author.google_plus }}?rel=author" target="_blank" class="hs-author-social-link hs-social-google-plus fa fa-google-plus-square"><span class="hs-screen-reader-text">Google Plus</span></a>
{% endif %}
</div>
</div>
{% endif %}
</div>
<br />
<h2 class="hs-author-listing-header">Recent Posts</h2>
{% endif %}
<!-- sets a variable for a the 5 most recent posts of my default CMS blog -->
{% set blog_one_posts = blog_recent_posts('default', limit=3) %}<!-- sets a variable for a the 5 most recent posts of my blog id 47082700. You can find the blog id in the URL of the blog dashboard for a particular blog-->
{% set blog_two_posts = blog_recent_posts('5110413671', limit=3) %} <!-- combines the two variables into a single variable and sorts them by publish date. Please note the sort filter requires all three parameters -->
{% set all_posts = (blog_one_posts + blog_two_posts) | sort(true, false, 'publish_date') %}
<!-- loop through posts in custom all posts variable -->
{% for post in all_posts %}
<div class="post-item">
{% if not simple_list_page %}
{% if post.post_list_summary_featured_image %}
<div class="hs-featured-image-wrapper">
<a href="{{post.absolute_url}}" title="" class="hs-featured-image-link">
<img src="{{ post.post_list_summary_featured_image }}" loading="lazy" class="hs-featured-image" alt="{{ post.featured_image_alt_text }}">
</a>
</div>
{% endif %}
<div class="post-header clearfix">
<h2><a href="{{post.absolute_url}}">{{ post.name }}</a></h2>
<p id="hubspot-author_data" class="hubspot-editable" data-hubspot-form-id="author_data" data-hubspot-name="Blog Author"><span class="fa fa-calendar"></span>
{{ post.publish_date_localized }} / by
{%if content.blog_post_author %}
<a class="author-link" href="{{ post.absolute_url }}/author/{{ post.blog_post_author.slug }}">{{ post.blog_post_author.display_name }}</a>
{% endif %}
{% if content.topic_list %}
posted in
{% for topic in content.topic_list %}
<a class="topic-link" href="{{ post.absolute_url }}/topic/{{ topic.slug }}">{{ topic.name }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
<!--comments-->
<span class="custom_listing_comments"><span class="fa fa-comment"></span>
<a href="{{post.absolute_url}}#comments-listing">
{% set comments_number = content.comment_list|length %}
{% if comments_number == 1 %}
{% set comments_label = "Comment" %}
{% else %}
{% set comments_label = "Comments" %}
{% endif %}
{{ comments_number }} {{ comments_label }}</a>
</span>
</p>
</div>
<div class="post-body clearfix">
<!--post summary--> {{ post.post_list_content|safe }}
</div>
<a class="more-link" href="{{ post.absolute_url }}">Read More </a><a class="fa fa-chevron-right" href="{{ post.absolute_url }}"></a>
<hr > {% else %}
<h2 class="post-listing-simple"><a href="{{post.absolute_url}}">{{ content.name }}</a></h2>
{% endif %}
</div>
{% endfor %}
</div><!--Blog-Pagination-->
Pagination to go here...
</div>
</div>