[nodebb-plugin-write-api] How to post HTML content ?

NodeBB Plugins

Suggested Topics


  • 4 Votes
    13 Posts
    289 Views

    @julian exactly that was the problem, thanks for the hint!

    for others who face maybe similiar issues:
    The following format worked for me (.csv format):

    username, email User1,[email protected] User2,[email protected]
  • 0 Votes
    2 Posts
    1k Views

    Check out https://github.com/akhoury/nodebb-plugin-import
    I don't think there's an adaptor for FluxBB... yet

  • Create custom route in plugin

    NodeBB Plugins
    2
    0 Votes
    2 Posts
    3k Views

    You define routes in your load hook. So your library.js might look like this:

    var Plugin = module.exports = {}; Plugin.load = function (params, callback) { var router = params.router; var middleware = params.middleware; // Define the function that renders the custom route. function render(req, res, next) { // Get whatever data you want to send to the template here. var data = {whatever: 33}; // This is the path to your template without the .tpl, relative to the templates directory in plugin.json var template = 'templatename' // Send the page to the user. res.render(template, data); } // This actually creates the routes, you need two routes for every page. // The first parameter is the actual path to your page. router.get('/yourpage', middleware.buildHeader, render); router.get('/api/yourpage', render); callback(); };

    And your plugin.json would look something like this:

    { "library": "library.js", "hooks": [ { "hook": "static:app.load", "method": "load" } ], "templates": "./public/templates", "staticDirs": { "public": "public" } }

    and you would have a template here:
    /nodebb-plugin-yourplugin/public/templates/templatename.tpl

    <h2>My Awesome Custom Page</h2> The Magic Number is: {whatever}

    I'm pretty sure I posted about this before, with more details even. Have to start using those canned responses. 🌹

  • 0 Votes
    2 Posts
    1k Views

    Just create a tpl file with the name of your page in the plugin and will be fine. Can be the same cose as the template already included
    i think one of the Pull request already do this but they in the limbo like many of them

  • 10 Votes
    25 Posts
    12k Views

    @phenomlab Thanks 🙂