DEV Community

loading...
Cover image for How to add custom javascript to Hugo

How to add custom javascript to Hugo

teamallnighter profile image Chris Connelly ・1 min read

Add the following to your config.toml

custom_js = ["js/custom.js"]
Enter fullscreen mode Exit fullscreen mode

in your head.html

{{ range .Site.Params.custom_js -}}
    <link rel="stylesheet" href="{{ . | absURL }}">
{{- end }}
Enter fullscreen mode Exit fullscreen mode

Under static -->js
save your custom.js file!

Rebuild

Discussion (0)

pic
Editor guide