Did it in another way
This post is the same question:
https://discourse.gohugo.io/t/how-to-include-a-script-on-only-one-content-page/20977
I have added an if statement to my footer like this:
<footer class="site-footer">
<div class="container">
<div class="row">
<div class="col-12">
<div class="site-footer-logo">
<a href="{{ .Site.BaseURL }}">
<img src="{{ .Site.Params.logo_footer | absURL }}" alt="logo-footer">
<span class="brand-logo-footer">Kettenbeil</span>
</a>
</div>
</div>
{{ with .Site.Params.footer.contactInfo }}
<div class="col-lg-3 col-md-6">
<div class="site-footer-widget">
<h5 class="site-footer-widget-title">{{ .title }}</h5>
<p class="site-footer-widget-description">
{{ if .address }}
{{ .address | safeHTML }}
<br>
{{ end }}
{{ if .phone }}
<a href="tel:{{ .phone }}">{{ .phone }}</a>
<br>
{{ end }}
{{ if .email }}
<a href="mailto:{{ .email }}">{{ .email }}</a>
{{ end }}
</p>
</div>
</div>
{{ end }}
{{ with .Site.Params.footer.sitemap }}
<div class="col-lg-2 col-md-6">
<div class="site-footer-widget">
<h5 class="site-footer-widget-title">{{ .title }}</h5>
<ul class="site-footer-widget-links">
{{ range .link }}
<li><a href="{{ .url | absURL }}">{{ .name }}</a></li>
{{ end }}
</ul>
</div>
</div>
{{ end }}
{{ with .Site.Params.footer.social }}
<div class="col-lg-2 col-md-6">
<div class="site-footer-widget">
<h5 class="site-footer-widget-title">{{ .title }}</h5>
<ul class="site-footer-widget-links">
{{ range .link }}
<li><a href="{{ .url }}">{{ .name }}</a></li>
{{ end }}
</ul>
</div>
</div>
{{ end }}
{{ with .Site.Params.footer.service }}
<div class="col-lg-3 col-md-6">
<div class="site-footer-widget">
<h5 class="site-footer-widget-title">{{ .title }}</h5>
<p class="site-footer-widget-description">
{{ .description | safeHTML }}
</p>
</div>
</div>
{{ end }}
<div class="col-lg-2 col-12">
<a href="#top" class="site-footer-widget-top">
<img src="{{ "images/to-top.svg" | absURL }}" alt="back-to-top">
<p>
{{ .Site.Params.footer.back_to_top.description | safeHTML }}
</p>
</a>
</div>
<div class="col-12">
<div class="site-footer-copyright">
<p>© Copyright {{ dateFormat "2006" now }} - All Rights Reserved by <a href="https://staticmania.com/" target="_blank">StaticMania</a> </p>
</div>
</div>
</div>
{{ if .Site.Params.footer.qr_print }}
<div class="row d-none d-print-block">
<div class="col col-lg-2">
{{ $qrcode := resources.Get "js/qrcode.js" | minify }}
<script src="{{ $qrcode.Permalink }}"></script>
<div id="qrcode">
<script type="text/javascript">
new QRCode(document.getElementById("qrcode"), {
text: "{{ .Page.RelPermalink | absURL }}",
width: 128,
height: 128,
});
</script>
</div>
</div>
<div class="col col-md-auto">
{{ .Page.RelPermalink | absURL }}
</div>
</div>
{{ end }}
</div>
</footer>
<!-- {{ $formhandler := resources.Get "js/formhandler.js" | minify }}
<script src="{{ $formhandler.Permalink }}"></script> -->
{{ $vendor := resources.Get "js/vendor.js" | minify }}
<script src="{{ $vendor.Permalink }}"></script>
{{ $script := resources.Get "js/script.js" | minify }}
<script src="{{ $script.Permalink }}"></script>
{{ if $.Param "videoTest" -}}
{{ $video := resources.Get "js/video.js" | minify }}
<script defer src="{{ $video.RelPermalink }}"></script>
{{ end -}}
and then set videoTest in content → _index.md to true
---
title: "Home"
videoTest: true
---
Got it from this repo:
https://github.com/frjo/hugo-theme-zen/blob/2117479a0bc564a061a42013ef173d5ff9bd3326/layouts/partials/scripts.html#L11-L14
Maby not the right/correct way… but I understand it.
The Mermaid example is a bit complicated. Maby someone can explain it better?