aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/head/index.html4
-rw-r--r--layouts/shortcodes/chart.html1
-rw-r--r--layouts/shortcodes/perf-chart.html1
3 files changed, 4 insertions, 2 deletions
diff --git a/layouts/partials/head/index.html b/layouts/partials/head/index.html
index eb096b8..a17582e 100644
--- a/layouts/partials/head/index.html
+++ b/layouts/partials/head/index.html
@@ -1,2 +1,6 @@
{{- partial "head/meta" . -}}
{{- partial "head/styles" . -}}
+
+{{- if or (.HasShortcode "chart") (.HasShortcode "perf-chart") -}}
+<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
+{{- end -}}
diff --git a/layouts/shortcodes/chart.html b/layouts/shortcodes/chart.html
index 2198b63..196bdfa 100644
--- a/layouts/shortcodes/chart.html
+++ b/layouts/shortcodes/chart.html
@@ -24,7 +24,6 @@
<canvas id="{{ $id }}"></canvas>
</div>
-<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const ctx = document.getElementById('{{ $id }}').getContext('2d');
diff --git a/layouts/shortcodes/perf-chart.html b/layouts/shortcodes/perf-chart.html
index c5b30aa..ff13130 100644
--- a/layouts/shortcodes/perf-chart.html
+++ b/layouts/shortcodes/perf-chart.html
@@ -47,7 +47,6 @@
<canvas id="{{ $id }}"></canvas>
</div>
-<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const ctx = document.getElementById('{{ $id }}').getContext('2d');