Skip to content

Commit db040b3

Browse files
author
Pierre Guceski
authored
Merge pull request DataDog#6848 from DataDog/zach/use-imgix
WEB-12 Use Imgix for Docs Images.
2 parents 6360f0f + fb60186 commit db040b3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

layouts/shortcodes/img.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{{ if not (.Get "src") }}
2+
{{ errorf "Img shortcode error: Missing value for param 'src': %s" .Position }}
3+
{{ end }}
14
{{- if eq (.Get "popup") "false" -}}
25
{{- $.Scratch.Set "popup" "false" -}}
36
{{- else -}}
@@ -8,10 +11,9 @@
811
{{- $img_height := .Get "height" -}}
912
{{- $wide := .Get "wide" -}}
1013
{{- $video := .Get "video" -}}
11-
{{- $local_ref := (.Get "src") -}}
12-
{{- $hash_ref := $local_ref -}}
13-
{{- $.Scratch.Add "_img" (print "images/" $hash_ref) -}}
14-
{{- $img := $.Scratch.Get "_img" -}}
14+
{{- $src := (.Get "src") -}}
15+
{{- $img := (print .Site.Params.img_url "images/" $src) -}}
16+
1517
{{- $image_type_arr := split (.Get "src") "." -}}
1618
{{- $image_ext := index $image_type_arr 1 -}}
1719
{{- if $wide -}}
@@ -44,7 +46,7 @@
4446
playsinline
4547
autoplay
4648
loop >
47-
<source src="{{ print $img | relURL }}"
49+
<source src="{{ (print "/images/" $src) | relURL }}"
4850
type="video/mp4"
4951
media="(min-width: 0px)" >
5052
<div class="play"></div>

0 commit comments

Comments
 (0)