Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Custom Helper documentation, creating a helper function not working

  • #1683
    Avatar photo[anonymous]

    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 the`config.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}}

    {{ tag.name }}

    {{/if}}

    {{/verifyTagName}}
    {{/each}}

    `
    The error is `MIssing: Helper`. How can I go about solving this?