If your end goal was to create shortlinks for easier social media, etc., distribution you may be interested in a thread I created some time ago in which I ended up creating short links with the YOURLS short link system.

I think the <noscript> ... </noscript> stuff at the end could probably go away since NodeBB requires javascript but I don't know how I would take the document.write line and reformat it to use, let's say, document.getElementById (or some other tag).