Templates System
-
If you're looking to modify templates in NodeBB, have a look at this wiki article. Let me know if I'm not clear anywhere. Don't forget to look at the theming section of the Widgets System for more advanced ways of utilizing the templates system.
Here's one more link explaining how to create a theme.
-
First time I looked at the repo the .tpl files struck me.
Did you write your own parser? Aren't there any good node-template parsers with localization?
Maybe this would be a possibility to also make it more intuitive for existing developers that want to contribute themes.
-
@jonathanmh Yes, @psychobunny wrote his own parser just for NodeBB, for several reasons, which he can explain
-
@psychobunny both of those links in the OP are blank, maybe update them or unpin this post?
-
@Tanner maybe the wiki pages had been merged into docs.
Creating a new NodeBB Theme
Writing Widgets for NodeBB -
Thanks man! Now we just have to wait for PB to update his OP
-
Haha updated, make sure you check out https://docs.nodebb.org/en/latest/themes/templates.html as well.
The PRs for OP is actually a really cool idea...
-
-
Hey,
Is it possible to customise widget templates by theme?Thank you
-
Hmm. I don't believe so (unless you're just doing CSS changes, then yeah)
If you want to modify the template I guess you can fork/modify the widget-essentials repo. Or build your own widget, it depends on what you want to achieve... I should make a guide on how to make your own widget plugins
BTW, if it's just front-end JS and HTML, you could even just copy and paste it directly into an HTML widget and you'd be good to go.
-
@psychobunny said:
BTW, if it's just front-end JS and HTML, you could even just copy and paste it directly into an HTML widget and you'd be good to go.
so I have to change it every time plugin updates
maybe it is better to implement overriding like for usual templatesis it possible to change fa-bell-o notification icon without editing nodebb sources to prevent problems while upgrading?
-
so I have to change it every time plugin updates
Actually no, I was talking about an HTML widget, so something like this:
-
what about "Recent Replies" widget?
-
I think you can actually just paste the entire contents of this into an HTML widget and it should work
-
Whats the syntax for commenting code in .tpl files ?
Is multi-line comment supported ? -
You can use normal HTML comments like
<!-- comment here -->
. If you really don't want the comment to be output in the html you can do something like{{{ if @false }}} Comment goes here {{{ end }}}
-
@PitaJ said in Templates System:
You can use normal HTML comments like
<!-- comment here -->
. If you really don't want the comment to be output in the html you can do something like{{{ if @false }}} Comment goes here {{{ end }}}
Thnx , works great