Skip to content

Commit b469956

Browse files
authored
Merge pull request #47376 from dipesh-rawat/cleanup-click-to-zoom
Refactor click-to-zoom option in figure shortcode to align with vanilla Docsy
2 parents bae74ae + da44bfa commit b469956

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed
File renamed without changes.

layouts/partials/head.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@
9191
<script defer src="{{ "js/release_binaries.js" | relURL }}"></script>
9292
{{- end -}}
9393

94-
<!-- Enable zoom-on-click for figures that opt in to this -->
95-
{{- if .HasShortcode "figure" -}}
96-
<script defer src="{{ "js/zoom.js" | relURL }}"></script>
97-
{{- end -}}
98-
9994
{{- if eq (lower .Params.cid) "community" -}}
10095
{{- if eq .Params.community_styles_migrated true -}}
10196
<link href="/css/community.css" rel="stylesheet"><!-- legacy styles -->

layouts/partials/hooks/head-end.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,14 @@
1313
{{- if .HasShortcode "cncf-landscape" -}}
1414
<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.9/iframeResizer.min.js" integrity="sha384-hHTwgxzjpO1G1NI0wMHWQYUxnGtpWyDjVSZrFnDrlWa5OL+DFY57qnDWw/5WSJOl" crossorigin="anonymous"></script>
1515
{{- end -}}
16+
17+
{{- if .HasShortcode "figure" -}}
18+
<!-- Enable zoom-on-click for figures that opt in to this -->
19+
{{- if hugo.IsProduction -}}
20+
{{- $zoomJs := resources.Get "js/zoom.js" | minify | fingerprint -}}
21+
<script defer src="{{ $zoomJs.RelPermalink }}" integrity="{{ $zoomJs.Data.Integrity }}" crossorigin="anonymous"></script>
22+
{{- else -}}
23+
{{- $zoomJs := resources.Get "js/zoom.js" -}}
24+
<script defer src="{{ $zoomJs.RelPermalink }}"></script>
25+
{{- end -}}
26+
{{- end -}}

0 commit comments

Comments
 (0)