Allright, I understand now, coming from wordpress/joomla developement, you think adding js to the header would work in the same way.
Your link provides indeed a solution, note that now the <script type='text/discourse-plugin>
headers are deprecated Modernizing inline script tags for templates & JS API
To quickly solve the url situation I ended up doing a permalink directly from discourse admin though.
Thank you for the support and explanation !