'Conditional Rendering Problems in Handlebars

I can't seem to conditionally render using the handlebars helpers I created

These are the helpers

handlebars.registerHelper("ifAdvertisement", function(type) {
    if (type == 'Advertisement')
        return true;
    else
        return false;
})

handlebars.registerHelper("ifProduct", function(type) {
    if (type == 'Product')
        return true;
    else
        return false;
})

These are the conditionals within my handlebars file

{{#ifAdvertisement this.type}}
                                                                                                                    

<span>
                                                                                                             
{{ removeSpaces this.type }} 
                                                                                                                     
</span>                                                                                                 
                                                                                                    
{{/ifAdvertisement}}                                                                                                            

{{#ifProduct this.type}}
                                                                                                                    
<span>
                                                                                                                            
{{ this.title }}                                                                                                                 
</span>                                                                                                                                                                                                                                                                                                                 
{{/ifProduct}}

For some reason when using my helpers, it just outputs falsetrue or truefalse. I assume this is because the helpers are just rendering their actual return, instead of evaluating to true and rendering my span elements. How would I go about rendering my own code blocks using my helpers?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source