diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 6fc51619..6233f60e 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -35,7 +35,7 @@
{{/* Include mermaid.js only on pages that use the shortcode */}}
-{{- if (in (string .Content) "class=\"mermaid\"") -}}
+{{- if .Page.HasShortcode "mermaid" -}}