Precision : step to disable markdown-it-checkbox in code is now not necessary since the following change made by @julianlam in nodebb-plugin-markdown...
https://github.com/julianlam/nodebb-plugin-markdown/issues/108
Howdy,
I'm trying to inject some custom data into all nodebb pages to make the data available for template rendering and javascript access.
My current approach is not working, I'm listening to the hook: filter:middleware.renderHeader. My plugin function for the hook is getting called with data that includes data.templateValues and then calls a callback with the data that was passed in:
hookRenderHeader: function(data, callback) {
data.templateValues.someTestValue = "hello";
return callback(null, data);
}
Thanks for any help or suggestions!
If you want data available on all template renders, you should use the hook filter:config.get
, example:
Plugin.configGet = function (config, next) {
config.someValue = "Some Data"
next(null, config)
}
Now in any template, including header.tpl, using {config.someValue}
will print Some Data
In the browser, the config values will not be available in ajaxify.data.someValue
but will be in config.someValue
Note that with this method, the values never change, unless the user reloads. If you need dynamic data on every template, you will need a different method, although I can't think of any use case for this.
Thank you @yariplus!!! That's exactly what I was hunting for.
Glad I could help!