I have different blog templates for English and Arabic. I want to create a template which shows a list of blogs from both of English and Arabic blog pages sorted by date.
I tried to make changes in the post listing in the template, as shown on this page:
{% set blog_one_posts = blog_recent_posts('5269069498', limit=5) %} <!-- sets a variable for a the 5 most recent posts of my default COS blog --> {% set blog_two_posts = blog_recent_posts('5213662779', limit=5) %} <!-- 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 all_posts = (blog_one_posts + blog_two_posts) | sort(true, false, 'publish_date') %} <!-- combines the two variables into a single variable and sorts them by publish date. Please note the sort filter requires all three parameters --> {% for post in all_posts %} <!-- loop through posts in custom all posts variable --> <div class="post-item"> {% if not simple_list_page %} <div class="post-header"> <h2><a href="{{post.absolute_url}}">{{ post.name }}</a></h2> <div id="hubspot-author_data" class="hubspot-editable" data-hubspot-form-id="author_data" data-hubspot-name="Blog Author"> Posted by {%if post.blog_post_author %} <a class="author-link" href=" {{ post.parent_blog.absolute_url }}/author/{{ post.blog_post_author.slug }}">{{ post.blog_post_author.display_name }}</a> on {{ post.publish_date_localized }} {% endif %} </div> {% blog_social_sharing "blog_social_sharing" overrideable=False, label='Blog Social Sharing' %} </div> <div class="post-body clearfix"> <!--post summary--> {% 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 }}" class="hs-featured-image"> </a> </div> {% endif %} {{ post.post_list_content|safe }} </div> {% if content_group.show_summary_in_listing %} <a class="more-link" href="{{ post.absolute_url }}">Read More</a> {% endif %} <div class="custom_listing_comments"> {% set comments_number = post.comment_list|length %} {% set comments_label = "Comment" if comments_number == 1 else "Comments" %} {{ comments_number }} {{ comments_label }} <a href="{{post.absolute_url}}#comments-listing">Click here to read/write comments</a> </div> {% if post.topic_list %} <p id="hubspot-topic_data"> Topics: {% for topic in post.topic_list %} <a class="topic-link" href=" {{ post.parent_blog.absolute_url }}/topic/{{ topic.slug }}</a>{% if not loop.last %},{% endif %} {% endfor %} </p> {% endif %} {% else %} <h2 class="post-listing-simple"><a href="{{post.absolute_url}}">{{ post.name }}</a></h2> {% endif %} </div> {% endfor %}