DEV Community

Cover image for How to add custom javascript to Hugo
Chris Connelly
Chris Connelly

Posted on

How to add custom javascript to Hugo

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

Top comments (0)