Display blogs with tags containing a space

Hi there,

I am using the blog_recent_tag_post function to find blogs based on the tags entered by a user. It isn’t working for any tags containing a space. For example, it will find blogs which have ‘trending’ as a tag but it won’t find a blog that has ‘most popular’ as a tag. Can anyone tell me why this would be? Below is my code:

{% set input = request.query_dict.term %}
{% set tag_posts = blog_recent_tag_posts('default', input, 100) %} 
<div class = "search-results">
{% for tag_post in tag_posts %}
 <a href="{{tag_post.absolute_url}}" title="" class="result-link">
 <div class = "result-image-container">
 <img src="{{ tag_post.featured_image }}" alt=" image"/>
 </div>
 <div class = "result-about">
 <div class="result-tags">
 {% if tag_post.topic_list %}
 {% for topic in tag_post.topic_list %}
 {% if loop.first %}
 <span class="ed-tag">{{ topic.name }}</span>
 {% endif %}
 {% endfor %}
 {% endif %}
 </div>
 <div class="result-date">
 <p>{{ tag_post.publish_date_local_time|datetimeformat('%B %e, %Y') }}</p>
 </div>
 </div>
 <div class = "result-text-container">
 <h4>{{ tag_post.name }}</h4>
 <p class = "result-description">{{ tag_post.meta_description }}</p>

 </div>
 </a>
 {% endfor %}
</div>

Hey @sgoodman ,

Are you still working on this? @Anton , @Kevin-C , could you all lend a hand :folded_hands:

Are you using the name or the slug? The function takes the slug. Space separated tag names when slugified have a “-”.

Hey!

Just use:

{% set input = request.query_dict.term|lower|replace(" ", "-") %}

Cheers :slightly_smiling_face:

THANKS !!

Do you make this code dynamic without reloading the page (something like AJAX behavior) ?

Can you teach me how can I do this?

Thanks

I want to do exactly the same.

Can you tell me how do you get this information?

request.query_dict.term

Thanks