@zenkamal 😆 I hereby proclaim this planet Trumania of the Burbank Galaxy.
How to print NodeBB current version in HTML
-
Hello,
I want to print NodeBB current version variable in footer HTML, but I'm unable to do that.
I figured out the version showing in Admin area is in filebuild/public/templates/admin/header.js
, so I reached this code:[[admin/menu:alerts.version, " +__escape(guard(context && context['version'])) +"]]
And when I use this code in my HTML, I get the below output.
HTML Code:{{[[admin/menu:alerts.version, " +__escape(guard(context && context['version'])) +"]]}}
Output:
{{Running NodeBB v" +__escape(guard(context && context['version'])) +"}}
Would you please me how to print that?
-
@inna files in
build
are compilation artifacts. Don't edit anything in there.What you want to do is add an HTML widget to your global footer. In your ACP go to Customize -> Widgets
Then add a widget to the global footer and put this in it:
[[admin/menu:alerts.version, {{ config.version }}]]
-
@pitaj Thanks, but it's not working.
This is the output when I do that:Running NodeBB v
The issue is it's not reading version.
I also tried using only[[{{ config.version }}]]
, but it's this output:[object Object]
-
@inna first let me explain how these tokens work
[[admin/menu:alerts.version, 1.2.3]]
This is a translation token. It gets replaced with
Running NodeBB v1.2.3
So you don't need to have
[[]]
around{{}}
if you want to print just the version:{{ version }}
However, it looks like the version isn't exposed on the front-end. So you'll either need to hard code it (and update it whenever you update NodeBB), or use a plugin hook to expose it.
-
@pitaj Thanks.
Other software like vBulletin, XenForo, etc. have version number dynamically in template files, in footer. So I've been thinking about this if you and other NodeBB devs decide whether it's good feature to add. -
It used to be there, but was removed
https://github.com/NodeBB/NodeBB/commit/cb4930dac8854976b68a174ad4b65815f7e63f62#diff-949f495d29fabde280ed4c38b2eaef79a5313bda04f180faa594c135dfffa1ecL22Not sure why
@inna feel free to open an issue on the Github page if you want this added back