Skip to content

Allow configurable `head` items for CSS or JS files

Currently it is necessary to overwrite the core/_head.html template (and configure a priority template directory for its path) in order to add resources to the head section of the emitted HTML content.

This is relevant for embedding additional CSS or JS assets.

At the moment there seem to be two use-cases:

  • A) refer to CSS stylesheet (e.g. )
  • B) include raw JS snippet (e.g. for matomo)

Instead we could offer configuration settings for these common necessities (without template overrides):

  • stylesheets: [] (list of URLs or paths)
  • javascript_snippets: [] (list of raw JS code fragments)
    • this would offer the additional benefit, that we can calculate the JS checksum for CSP_SCRIPT_SRC automatically, instead of forcing the admin to do this manually

There are some open questions:

  1. Would this be useful?
  2. Are stylesheet references sufficient or should we provide generic header entries instead (for arbitrary raw HTML)?
  3. Would javascript_snippets be the proper name or should we name it javascript_header_snippets, in order to allow future configuration settings for other places?
Edited by Lars Kruse