Conditional Statement on Blog Listing page

SOLVE
InciteJoe
Participant | Gold Partner

I am trying to render a custom module **bleep** if it has been set

 

Here is the custom module markup on the listing page

{% text "resource-url" label='Resource URL', **bleep**='', export_to_template_context=True %}

and here is my conditional code for the blog listing, is == ' ' a correct way to check?

 

{% set rec_posts = blog_recent_posts('default', 4) %}
<div class="featured-posts">
{% for rec_post in rec_posts %}

{% if rec_post.widgets.resource-url.body.**bleep** == '' %} <div class="post-title"><h2><a href="{{ rec_post.absolute_url }}">{{ rec_post.name|truncate(37,true,'...') }}</a></h2></div> {% elif rec_post.widgets.resource-url.body.**bleep** != '' %} <div class="post-title"><h2><a href="{{ rec_post.widgets.resource-url.body.**bleep** }}">{{ rec_post.name|truncate(37,true,'...') }}</a></h2></div> {% else %} <div class="post-title"><h2><a href="{{ rec_post.absolute_url }}">{{ rec_post.name|truncate(37,true,'...') }}</a></h2></div> {% endif %}

 Currently the absolute_url is the **bleep** everytime

0 Upvotes
1 Accepted solution

Accepted Solutions
anders_grove
Solution
Contributor | Elite Partner
{% text "resource_url" label='Resource URL', **bleep**='', export_to_template_context=True %}

{% if widget_data.resource_url.**bleep** %}
    <!--True-->
    <p>The custom widget has a **bleep**</p>
{% else %}
    <!--False-->
    <p>The custom widget doesn't have a **bleep**</p>
{% endif %}

View solution in original post

0 Upvotes
2 Replies 2
anders_grove
Solution
Contributor | Elite Partner
{% text "resource_url" label='Resource URL', **bleep**='', export_to_template_context=True %}

{% if widget_data.resource_url.**bleep** %}
    <!--True-->
    <p>The custom widget has a **bleep**</p>
{% else %}
    <!--False-->
    <p>The custom widget doesn't have a **bleep**</p>
{% endif %}

View solution in original post

0 Upvotes
InciteJoe
Participant | Gold Partner

Ahh thank you, it was the name of my variable!

0 Upvotes