Display Header HTML to only Logged in Users

yes, i know how css works :wink:

but this is no solution.

i dont want that not logged in users can see the html in page-source or it can be indexd by search engines.

its a closed forum and hiding with css is no solution.

i already tried this in the admin backend:
https://meta.discourse.org/t/adding-plugin-outlets-using-a-theme/32727/12

but without success.
the script tag an inner-html is not published.