scripts

JavaScript files loaded site-wide. When set, this replaces the deprecated js and hugo_js parameters.

PropertyDetails
Type{url: string, type?: string, defer?: boolean, cache?: boolean, integrity?: string}[]
Accepted values
  • url (string, required) — path or URL to the script file
  • type (string, optional) — value for the type attribute, e.g. module
  • defer (boolean, optional) — adds the defer attribute
  • cache (boolean, optional) — appends ?v=<timestamp> to bust the browser cache
  • integrity (string, optional) — value for the integrity attribute (SRI)

Example

[[Params.scripts]]
  url = "/js/main.mjs"
  type = "module"
  cache = true

[[Params.scripts]]
  url = "https://cdn.example.org/widget.js"
  defer = true
  integrity = "sha384-..."

Configuration