Skip to content

Commit 231e881

Browse files
authored
fix: replaced getJSON with transform.Unmarshal (#87)
1 parent 275b157 commit 231e881

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

layouts/shortcodes/dimensions.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11

2-
{{ $jsPath := .Get "path" }}
3-
{{ $dimensionsRef := getJSON $jsPath }}
2+
{{ $rawJSPath := .Get "path" }}
3+
{{ $jsPath := replace $rawJSPath "/static" "" }}
4+
{{ $dimensionsRef := dict }}
5+
{{ with resources.Get $jsPath }}
6+
{{ with .Err }}
7+
{{ errorf "%s" . }}
8+
{{ else }}
9+
{{ $dimensionsRef = . | transform.Unmarshal }}
10+
{{ end }}
11+
{{ else }}
12+
{{ errorf "Unable to get asset resource %q" $jsPath }}
13+
{{ end }}
14+
415

516
<div class="row flex-xl-nowrap">
617

layouts/shortcodes/metrics.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11

2-
{{ $jsPath := .Get "path" }}
3-
{{ $metricsRef := getJSON $jsPath }}
2+
{{ $rawJSPath := .Get "path" }}
3+
{{ $jsPath := replace $rawJSPath "/static" "" }}
4+
{{ $metricsRef := dict }}
5+
{{ with resources.Get $jsPath }}
6+
{{ with .Err }}
7+
{{ errorf "%s" . }}
8+
{{ else }}
9+
{{ $metricsRef = . | transform.Unmarshal }}
10+
{{ end }}
11+
{{ else }}
12+
{{ errorf "Unable to get asset resource %q" $jsPath }}
13+
{{ end }}
14+
415

516

617

0 commit comments

Comments
 (0)