Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dzello/reveal-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Genest <david.genest@ubisoft.com>2022-10-23 22:25:26 +0300
committerDavid Genest <david.genest@ubisoft.com>2022-10-23 22:25:26 +0300
commit6de73e5365f80982e3c2ca0e85168233c47c897e (patch)
treed12d7a34949f7352755013494676ab708af56cfe
parentc82ab18c94486a2d3ea7e36132879a0e0e7064c0 (diff)
use build-time mermaid js resource fetch
This removes the need for CDN at each site-load as we download mermaid js library at hugo build-time. The mermaid script becomes part of the static site. Note that, at build time, the mermaid resource is not downloaded if there are no mermaid blocks in the site. closes #122
-rw-r--r--layouts/partials/layout/javascript.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/layouts/partials/layout/javascript.html b/layouts/partials/layout/javascript.html
index aefbf93..c5c70e2 100644
--- a/layouts/partials/layout/javascript.html
+++ b/layouts/partials/layout/javascript.html
@@ -71,7 +71,8 @@
{{ end }}
{{ if $hasMermaid }}
- <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
+ {{ $mermaidSrc := resources.GetRemote "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js" }}
+ <script src="{{ $mermaidSrc.RelPermalink }}"></script>
<script>
mermaid.initialize({startOnLoad: false});
let render = (event) => {