Skip to content

Commit 1ad88ac

Browse files
committed
Try to fix build
1 parent 0d057a7 commit 1ad88ac

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{{- $file := .Destination -}}
2+
{{- $imagesDir := .Page.Site.Params.imagesDir -}}
3+
{{- $alt := .Text -}}
4+
{{- $cap := .Title -}}
5+
{{- $scratch := newScratch -}}
6+
{{- $scratch.Set "classes" "image_figure" -}}
7+
8+
{{/* Determine if page bundles are set. */}}
9+
{{- $bundle := .Page.Site.Params.usePageBundles -}}
10+
{{- if eq .Page.Params.usePageBundles false -}}
11+
{{- $bundle = false -}}
12+
{{- end -}}
13+
{{- if eq .Page.Params.usePageBundles true -}}
14+
{{- $bundle = true -}}
15+
{{- end -}}
16+
17+
{{/* Determine source of image and get attributes. */}}
18+
{{- $image := "" -}}
19+
{{- if strings.HasPrefix $file "http" -}}
20+
{{- $scratch.Add "classes" " image_external" -}}
21+
{{- $image = resources.GetRemote $file -}}
22+
{{- with $image }}
23+
{{- if eq $image.MediaType.MainType "image" -}}
24+
{{- if eq $image.MediaType.SubType "svg" -}}
25+
{{- $image = "" -}}
26+
{{- $scratch.Add "classes" " image_svg" -}}
27+
{{- else -}}
28+
{{- $file = path.Join $imagesDir $image -}}
29+
{{- $image = $image.Content | resources.FromString $file -}}
30+
{{- end -}}
31+
{{- else -}}
32+
{{- $image = "" -}}
33+
{{- end -}}
34+
{{- end -}}
35+
{{- else -}}
36+
{{- $scratch.Add "classes" " image_internal" -}}
37+
{{ $file = (path.Clean $file) }}
38+
{{- if eq $bundle true -}}
39+
{{ $image = .Page.Resources.GetMatch $file }}
40+
{{- if and (not $image) .Page.File -}}
41+
{{ $file = path.Join .Page.RelPermalink $file }}
42+
{{ $image = resources.Get $file }}
43+
{{- end -}}
44+
{{- end -}}
45+
{{- end -}}
46+
47+
{{ with $.Page.File }}
48+
{{- partial "figure" (
49+
dict
50+
"file" $file
51+
"image" $image
52+
"diskPath" $.Page.File.Dir
53+
"webPath" $.Page.RelPermalink
54+
"alt" $alt
55+
"cap" $cap
56+
"classes" ($scratch.Get "classes")
57+
"bundle" $bundle
58+
) -}}
59+
{{ end }}

layouts/partials/comments.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class="post_comments">
2+
{{ if .Site.Config.Services.Disqus.Shortname }}
3+
{{ template "_internal/disqus.html" . }}
4+
{{ end }}
5+
{{ if .Site.Params.utterances }}
6+
{{ template "partials/utterances.html" . }}
7+
{{ end }}
8+
<!-- add custom comments markup here -->
9+
</div>

0 commit comments

Comments
 (0)