Content Security Policy
The theme writes no inline JavaScript. Its settings travel as JSON data blocks and all of its code comes from script files, so your site can be served with a strict Content Security Policy.
Policy
This policy covers every feature of the theme except Mermaid and math
style-src-attr 'unsafe-inline' allows style attributes: the theme writes colors and image sizes given in your content as such, and Hugo colors highlighted code this way unless you set markup.highlight.noClasses=false. If none of this applies and you use neither Mermaid nor math, which write style attributes as well, you can leave it out. Inline <style> elements stay forbidden; the theme writes none.
What Needs More
- Mermaid: Mermaid writes its styles into inline
<style>elements. Addstyle-src-elem 'self' 'unsafe-inline'- with'self'repeated, as it replacesstyle-srcfor all style elements. - Math: MathJax does the same and needs the same
style-src-elem. It also starts a worker from ablob:URL and loads its fonts fromhttps://cdn.jsdelivr.net, so addworker-src blob:andhttps://cdn.jsdelivr.nettofont-src. - Inlined SVGs: an SVG shown with the
inlinecontentimage effect brings its own<style>elements into the page, if it has any, and needs the samestyle-src-elem. - Libraries from elsewhere: if you set
customMathJaxURL,customMermaidURLorcustomOpenapiURL, add their origin toscript-src, and for Swagger UI tostyle-srcas well. - Your own inline JavaScript: a
javascript:URL as thehrefof a button, card or topbar button is blocked. Give it anactioninstead and handle that in a script file.
Subresource Integrity
Set enableSubresourceIntegrity=true to have the theme add an integrity hash to each script and stylesheet it links, including the search index and the stylesheets of the OpenAPI shortcode. A browser then refuses a file that changed after the build.
Not for the file system
A browser can not check an integrity hash for a page opened from the file system and refuses the file instead, which leaves the page without any script or style. Keep this off if your site must work that way.