summaryrefslogtreecommitdiff
path: root/layouts/_default
diff options
context:
space:
mode:
authorroninro <liumy.f@foxmail.com>2022-07-29 19:47:30 +0800
committerroninro <liumy.f@foxmail.com>2022-07-29 19:47:30 +0800
commitfb84df6f8190a850b0456ca144139598bdb2800c (patch)
treec5d09ca27d988868a5d3d9342efe943f81e5995e /layouts/_default
parentf0e8a71001ad71fbeeab702eee7375f9c1d06960 (diff)
support Medium's Image Zoom
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/_markup/render-image.html10
-rw-r--r--layouts/_default/baseof.html6
-rw-r--r--layouts/_default/single.html1
3 files changed, 15 insertions, 2 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
new file mode 100644
index 0000000..f4f9389
--- /dev/null
+++ b/layouts/_default/_markup/render-image.html
@@ -0,0 +1,10 @@
+<figure>
+ <a class="paragraph-image">
+ <img src="{{ .Destination | safeURL }}" data-action="zoom" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}"{{ end }} loading="lazy" decoding="async">
+ </a>
+ {{ with .Title }}
+ <figcaption class="image-caption">
+ {{- . | safeHTML -}}
+ </figcaption>
+ {{ end }}
+</figure> \ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 3b18f33..a57646a 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -33,6 +33,10 @@
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
+ {{ $zoom_css := resources.Get "zoomjs/zoom.css" | resources.Minify }}
+ <link rel="stylesheet" href="{{ $zoom_css.Permalink }}">
+
+
{{ range .Site.Params.custom_css -}}
{{ $custom_template := resources.Get . }}
{{ if $custom_template }}
@@ -69,7 +73,7 @@
{{ .Scratch.Set "header_img" $header_img }}
{{ end }}
- {{ if and .IsPage (gt .WordCount 400 ) (.Params.toc) }}
+ {{ if and .IsPage (.Params.toc) }}
{{ .Scratch.Set "toc" true }}
{{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 54f3e8b..a16b66c 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -10,7 +10,6 @@
col-lg-8 col-lg-offset-2
col-md-10 col-md-offset-1
post-container">
- {{ .TableOfContents }}
{{ .Content }}
<hr style="visibility: hidden;" />