I use Hugo extendet, Bootstrap 5 and Sass. Since I need a dropdown menu it also needs javascript. After some searching I found the following modules:
module:
imports:
- path: github.com/gohugoio/hugo-mod-bootstrap-scss/v5
- path: github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 -------- Is this line correct?
in the footer.html i added the following code:
{{ $indexJS := resources.Get "js/index.js" | js.Build }}
<script src="{{ $indexJS.Permalink }}"></script>
go mod init example.com
go mod tidy
hugo server
and the site will be built correctly. Only the dropdown menu does not work. If I use the following code instead, the dropdown menu works fine. What has to be in the assets/index.js?
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>