I’m working on a Locomotive CMS site and am looking for a way to list posts by categories dynamically.
For example I have two data models: Posts and Category
The Posts data model has a belong_to attribute associated with Category. I also have a templatized view of categories.
I'd like to do something like:
{% with_scope category: category._slug %}
{% for post in contents.post %}
{{post.title}}
{% endfor %}
{% endwith_scope %}
on the templatized category page, but so far it doesn't return any results, even though there are posts with those categories.
Any ideas? Thank you!
I found this unanswered question in the process of trying to figure this out as well.
Here is a solution:
This will work on a standard page. I expect the templatised page may be more problematic, but I need to implement that as well so will update my answer when/if I find a solution.