Sign in

Custom Helper documentation, creating a helper function not working

  • This topic has 0 replies, 1 voice, and was last updated 2 weeks ago by stevenaguilar.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1683
    stevenaguilar

    Currently I’m getting a Missing Helper method when trying to launch the theme preview.
    module.exports = function (Handlebars) { return { verifyTagName: function(tagName) { let tagNamesNotToUse = ['Full Time', 'Apprenticeship', 'Temp'] tagNamesNotToUse.forEach(tag => { if(tag === tagName){ return false; } }) return true; } }; };
    I have the above code in /themes/starter/helper.js. I also change the configuration to theconfig.json file.

    “renderer”: {
    "includeHandlebarsInHelpers": true,

    As per the documentation shown here https://getpublii.com/dev/how-to-create-custom-handlebars-helpers/

    However I get the error from this code.
    {{#each @website.contentStructure.tags as |tag|}} {{#verifyTagName tag.name}} {{#if tag.postsNumber}} <h4 class="h3">{{ tag.name }}</h4> {{/if}} <ul class="list-none p-0 color-mid-background" id="jobs-list"> {{#each this.posts}} <li class="py-1 px-2"> <a href="{{url}}"> {{title}} </a> </li> {{/each}} </ul> {{/verifyTagName}} {{/each}}
    The error is MIssing: Helper. How can I go about solving this?

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.