Sign in

Custom Helper documentation, creating a helper function not working

  • This topic has 0 replies, 1 voice, and was last updated 5 months 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 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?

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