Changes to theme .tpl files don't show live



  • Hi everyone,

    I have an issue with editing the theme of my NodeBB board. I've already posted about it here but didn't manage to find a solution.

    Here's what I've done so far. First, I have created a new theme by:

    • Duplicating the nodebb-theme-persona folder under /opt/nodebb/node_modules;
      -Renaming the new folder to nodebb-theme-mywebsite;
    • Changing theme data in theme.json;
    • Going in the admin panel and activating the new theme.

    Up to that point, everything was fine. The new theme was (and is) working correctly. But then came the problem - no matter what I do to .tpl files, nothing in the theme changes live.

    A few remarks:

    • No, I'm not editing the files under /opt/nodebb/build/public/templates. As stated above, I'm editing files under /opt/nodebb/node_modules/nodebb-theme-mywebsite;
    • Yes, the files I change are getting uploaded correctly;
    • Yes, I've tried running ./nodebb build after uploading the changes;
    • Yes, I've tried restarting the forums, both from the linux shell and from the admin panel.

    Any clue on what might be going on? I've also tried changing the persona theme itself, but to no avail. No change there is shown live too.

    Thanks everyone!


  • Plugin & Theme Dev

    @Jarko did you change the id in plugin.json?



  • @pichalite said in Changes to theme .tpl files don't show live:

    @Jarko did you change the id in plugin.json?

    Hi pichalite! No, I hadn't done that! I just did (replaced "id": "nodebb-theme-persona" with "id": "nodebb-theme-mywebsite"), uploaded, run ./nodebb build and restarted... but nothing happened.

    Also, I just went into /opt/nodebb/build/public/templates and noticed the files (categories.tpl, category.tpl, etc) haven't changed at all after the build process. I have switched the position of breadcrumb and header in my theme's .tpl files, and those changed should be reflected in the build/public folder, correct?


  • Plugin & Theme Dev

    @Jarko you may have to switch the theme in ACP again before running build. You can also set the theme from command line which also runs the build.

    ./nodebb reset -t mywebsite



  • @pichalite said in Changes to theme .tpl files don't show live:

    @Jarko you may have to switch the theme in ACP again before running build. You can also set the theme from command line which also runs the build.

    ./nodebb reset -t mywebsite

    I had swtiched the theme already in the APC. I also tried this command, it runs fine, but nothing changed :'(

    Out of curiosity, I changed the files directly in the persona theme (which I guess is something I shouldn't do), uploaded and built, then switched to the persona theme in the ACP and restarted. Surprise surprise, the changes now work, I can see them in build/public and when browsing the forums... which reinforces my hypothesis that I did something wrong in the creation of my new template and somehow NodeBB is falling back on the persona theme (or the files of the persona theme) even tho the ACP says the theme mywebsite is active.

    When creating a new theme, what are the files that need to be changed? Could package.json have something to do with this? I never touched that one...


  • Admin

    @Jarko Yes the id field in plugin.json is not used, you need to change the name field in package.json



  • @baris said in Changes to theme .tpl files don't show live:

    @Jarko Yes the id field in plugin.json is not used, you need to change the name field in package.json

    ...and that was the issue indeed! Thank you! 💃


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.