SOLVED theme-quickstart: template created, is found (no 404) but not rendered.


  • Using nodebb-theme-quickstart.

    Created a new template which is found but not rendered (white page).

    Same content in pre-existing template is rendered fine.

    What am I missing or is something missing in the quickstart theme?

    Also, I'd like to complement the nodebb docs on theme development as there seem to be things missing or incomplete. How to do so?

    Thank you!

  • Global Moderator Plugin & Theme Dev

    What exactly did you change? You added a template file. Did you add a route handler? Share your code.


  • @pitaj The theme-quickstart README does not mention anything about route handlers. Nor is any hint given in the source files themselves. I'm new to this kind of framework, obviously.

    I suspected this being related to a register function of sorts. Trying to reimplement what is used in plugin-quickstart in theme-quickstart was unsuccessful (white page as well).

    My next step would've been to have a look at the custom pages plugin to see how it is done in another plugin (I'm trying to create a cusom theme here).

    Once I got this I'm fine with extending the documentation. It would've helped if this kind of stuff was given in what already exists as documentation.

    Thank you!

  • Global Moderator Plugin & Theme Dev

    Without knowing what you changed, I can't tell you where you went wrong. Please answer all of the questions I ask.

    Do you get any errors in the server logs or in your browser console when you attempt to access the page?

    Trying to reimplement what is used in plugin-quickstart in theme-quickstart was unsuccessful (white page as well).

    Yes, plugin quick start is where you want to look if you're adding new pages. https://github.com/NodeBB/nodebb-plugin-quickstart/blob/104b739ed8f8a82b36f92fa4b680238ebb1d8306/library.js#L19


  • @pitaj said in theme-quickstart: template created, is found (no 404) but not rendered.:

    Without knowing what you changed, I can't tell you where you went wrong. Please answer all of the questions I ask.

    There hasn't been much to share. See below.

    Do you get any errors in the server logs or in your browser console when you attempt to access the page?

    No errrors.

    Yes, plugin quick start is where you want to look if you're adding new pages. https://github.com/NodeBB/nodebb-plugin-quickstart/blob/104b739ed8f8a82b36f92fa4b680238ebb1d8306/library.js#L19

    That's what I did, add lines 19 to 25 from your link to my theme's init, change it to reflect the filename. Still only white page displayed.

    It somehow seems to be working now. Switched themes forth and back, now it's working. šŸ˜•

    At least partially so. The template gets rendered, the associated js is however not exec'd:

    template/mynewtemplate.tpl:

    <div class="well">
    <p>This is a custom page. </p>
    <p>Your uid is {uid}!</p>
    <p id="last-p"></p>
    </div>
    

    lib/mynewtemplate.js:

    'use strict';
    define('mynewtemplate', function ()                         
      var module = {};
      module.init = function () {
        $('#last-p').text('mynewtemplate.js loaded!');                      
      };
      return module;
    });
    

    The id 'last-p' is not exec'd.

    Console errors:

    GET /manifest.webmanifest 401 (Unauthorized)
    manifest.webmanifest:1 Manifest: Line: 1, column: 1, Syntax error.
    

    Obviously, I'm auth'd and cross-origin is set to use-credentials.

    How can I improve on the documentation once this is working as expected?


  • SOLVED

    In the end, it was a proxy/cache issue, I assume. After fixing the proxy directives' placement in nginx config, disabling nginx caching, rebuilding and reloading nodebb and switching themes and back again, the issue was no longer there. After reenabling caching, everything was still ok. In case it should become clearer what caused the issue, I'll update this answer.

    For the JS issue, refer to https://community.nodebb.org/topic/16031/template-js-not-executed .

    Thanks.

  • Topic has been marked as solved  B Bejan 

Suggested Topics

| |