Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jesselau76/hugo-w3-simple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjesselau76 <jesselau76@gmail.com>2018-11-27 00:57:34 +0300
committerjesselau76 <jesselau76@gmail.com>2018-11-27 00:57:34 +0300
commit57f5b3cb3ad8d605ac542aa639117b89a1c4c044 (patch)
tree37baa7771f25b74b945093f923157abae09c1784 /layouts
parent3d298f9cf8e30401969b55a224a718964342d147 (diff)
readme update
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.html28
-rw-r--r--layouts/post/single.html14
2 files changed, 27 insertions, 15 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index ea1264d..67a8e43 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -20,33 +20,33 @@
<div class="w3-card-2 w3-hover-shadow " >
{{ with .Params.thumbnail }}
-
+ <div class="w3-hover-opacity thumb">
{{ if eq ( $.Scratch.Get "novisual") 1 }}
- <div class="w3-hover-opacity ">
- <img src="placeholder.svg" data-src="{{ relURL . }}" alt="Thumbnail" />
+
+ <img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ relURL . }}" alt="Thumbnail" />
{{ else }}
- <div class="w3-hover-opacity ">
+
<img src="{{ relURL . }}" alt="Thumbnail" />
{{ end }}
</div>
{{ else }}
{{ if .Site.Params.firstpic}}
- {{ if .Site.Params.lazyload | and (eq ( .Scratch.Get "novisual") 1) }}
+
{{ $img := findRE "<img .*?src=\"(.*?)\".*?>" .Content 1 }}
{{ range $img }}
- <div class="w3-hover-opacity "><img src="placeholder.svg" data-src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail"/></div>
- {{ end }}
- {{ else }}
- {{ $img := findRE "<img .*?src=\"(.*?)\".*?>" .Content 1 }}
- {{ range $img }}
-
- <div class="w3-hover-opacity "><img src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail" /></div>
- {{ end }}
+ <div class="w3-hover-opacity thumb ">
+ {{ if eq ( $.Scratch.Get "novisual") 1 }}
+
+ <img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail"/></div>
+
+ {{ else }}
+ <img src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail" /></div>
+ {{ end }}
{{ end }}
{{ end }}
- {{ end }}
+ {{ end }}
<header class="w3-container wraptext w3-text-indigo">
<h4><a href="{{ .URL }}">{{ .Title | markdownify }}</a></h4>
diff --git a/layouts/post/single.html b/layouts/post/single.html
index fd29ef9..d59445b 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -46,7 +46,19 @@
<!-- Content -->
<div class="w3-container">
- {{ .Content }}
+ {{ if .Site.Params.lazyload }}
+ {{ $img := findRE "src=\"(.+?png|jpg|jpeg|gif|bmp)\"" .Content }}
+ {{ if gt (len $img) 1 }}
+
+ {{ (.Content | replaceRE "src=\"(.+?png|jpg|jpeg|gif|bmp)\"" "src=\"/placeholder.svg\" data-src=\"$1\"") | safeHTML }}
+ {{ else }}
+ {{ .Content }}
+ {{ end }}
+
+
+ {{ else }}
+ {{ .Content }}
+ {{ end }}
</div>