May 7, 2018 3:20 PM
Hi! I am hoping someone has an answer as to how to modify my code below to add in the topic/tag next to the posted date, based on each blogs topics.
{% set posts = blog_recent_posts('default', 3) %} <div class="background-image" style="background-image: url({{ widget.background_image.src }});{% if widget.parallax_background %}background-attachment: fixed;{% endif %}"> <div class="section section--features section--{{ widget.spacing }} section--{{ widget.background_color }}" style="background-color: {{ widget.background_color_override }};"> <div class="container"> {% if widget.heading != "" %} <div class="row-fluid hubstrap-row-center"> <div class="span6 hubstrap-col"> <div class="heading">{{ widget.heading }}</div> </div> </div> {% endif %} <div class="recent-posts row-fluid hubstrap-row"> {% for post in posts %} <div class="span4 hubstrap-col"> <p> {{ post.publish_date_localized }} | <a href="#">Topics/Tags</a> </p> <h3><a href="{{ post.absolute_url }}">{{ post.name }}</a></h3> <p> <a class="cta_button get-started-cta" href="{{ post.absolute_url }}">Read More</a> </p> </div> {% endfor %} </div> </div> </div> </div>
Thanks in advance!
Solved! Go to Solution.
May 7, 2018 3:40 PM - edited May 7, 2018 3:40 PM
You need to loop through the topics per post:
{% for post in posts %} {{ post.publish_date_localized }} | {% for topic in post.topic_list %} <a class="topic-link" href="{{ blog_tag_url(group.id, topic.slug) }}"> {{ topic.name }} </a>{% if not loop.last %},{% endif %} {% endfor %} {% endfor %}
May 7, 2018 3:40 PM - edited May 7, 2018 3:40 PM
You need to loop through the topics per post:
{% for post in posts %} {{ post.publish_date_localized }} | {% for topic in post.topic_list %} <a class="topic-link" href="{{ blog_tag_url(group.id, topic.slug) }}"> {{ topic.name }} </a>{% if not loop.last %},{% endif %} {% endfor %} {% endfor %}
Oct 14, 2019 3:08 AM
Can I show up to 2 topics on the blog listing page?
May 7, 2018 3:44 PM
You're the best! works like a charm now.
May 7, 2018 3:52 PM
Glad I could help. please mark as solved.