CMS Development

radar
投稿者

Combine two topics into one list, outside blog

解決

Is it possible to combine two topics into one list? When I say combine, I mean only show posts where the given set of topics are present at the same time. 

 

For example:

 

 

{% set topic1 = blog_recent_topic_posts('default', 'topic1_name', limit=25) %} 
{% set topic2 = blog_recent_topic_posts('default', 'topic2_name', limit=25) %}

{% set all_posts = (topic1 + topic2) | sort(true, false, 'publish_date') %}

{% for post in all_posts %}
{# markup #}
{% endfor %}

 

 

If working as intended this would yield a list of results where only topic1 and topic2 are present on the same post.

 

The error I've had is the resulting list shows all posts with topic1 and then a duplicate post with topic1 + topic2.

 

Any thoughts?

 

0 いいね!
1件の承認済みベストアンサー
radar
解決策
投稿者

Combine two topics into one list, outside blog

解決

That documentation is helpful, not quite what I was looking for though. Essentially I was going to use HubL to display a series of posts based on a specific combination of tags only if they were both mutually present at the same time.

 

Said another way, instead of getting all posts tagged with either topic1 and or topic2, only show posts when topic1 and topic2 exist together. 


I ended up using some filtering, post IDs and a drop down to select specific posts to show where relevant. This was for a directory listing, not a traditional blog if curious.

元の投稿で解決策を見る

0 いいね!
3件の返信
jennysowyrda
コミュニティーマネージャー
コミュニティーマネージャー

Combine two topics into one list, outside blog

解決

Hi @radar,

 

Are you still experiencing this issue? 

 

Have you taken a look at the HubL docs and tuitorials? They may be a good starting point to take a look at. I wanted to share this tuitorial for reference (see more along the left hand side).

 

If you're still having issues after taking a look at those, please let us know. 

 

Thank you,

Jenny

0 いいね!
radar
解決策
投稿者

Combine two topics into one list, outside blog

解決

That documentation is helpful, not quite what I was looking for though. Essentially I was going to use HubL to display a series of posts based on a specific combination of tags only if they were both mutually present at the same time.

 

Said another way, instead of getting all posts tagged with either topic1 and or topic2, only show posts when topic1 and topic2 exist together. 


I ended up using some filtering, post IDs and a drop down to select specific posts to show where relevant. This was for a directory listing, not a traditional blog if curious.

0 いいね!
jennysowyrda
コミュニティーマネージャー
コミュニティーマネージャー

Combine two topics into one list, outside blog

解決

Thank you for sharing @radar

0 いいね!