So an error raised by a bad inbound link will serve the flat page, whereas an error from a bad internally navigated link would still contain those elements.
Just another reminder: I work mostly with content and human’s way to use content, and I’m a webmaster, sysadmin and admin of everything just because I’m poor and small fish…
But — can the issue here is so simple that because Discourse is kind of a-typical web-solution it is harder or close to impossible send JS-based content when serving html status error 404 that needs static content in the meaning how a client sees it? I don’t know at all what W3C, RFC etc. says.
But discourse isn’t web pages, it’s a single page JavaScript app.
If you visit the app via a nonexistent route, such as a broken link, then you are served a static 404 page which is styled to look like the rest of the site. It isn’t part of the app, so can’t function like it.
If you click an internal link (from within the app) to a page which doesn’t exist then it serves you a 404 error within the app itself.