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

github.com/it-gro/hugo-theme-w3css-basic.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-gro <13005925+it-gro@users.noreply.github.com>2021-08-27 20:44:10 +0300
committerit-gro <13005925+it-gro@users.noreply.github.com>2021-08-27 20:44:10 +0300
commitf2b0dc0264d98fcfd63b42617ed7724746e4fe67 (patch)
tree388deaed8b80b63ab5f82cbd199ec739ef088f0d
parent7f37cfba840f2d6c9ac2ec8b73c3c4990f8dd570 (diff)
wip
-rw-r--r--exampleSite/content/pages/hugo-theme-w3css-basic/page-shortcodes/index.md5
-rw-r--r--layouts/shortcodes/res-figure.html9
-rw-r--r--layouts/shortcodes/w3-col-youtube.html26
3 files changed, 38 insertions, 2 deletions
diff --git a/exampleSite/content/pages/hugo-theme-w3css-basic/page-shortcodes/index.md b/exampleSite/content/pages/hugo-theme-w3css-basic/page-shortcodes/index.md
index e3171aa..324b1ef 100644
--- a/exampleSite/content/pages/hugo-theme-w3css-basic/page-shortcodes/index.md
+++ b/exampleSite/content/pages/hugo-theme-w3css-basic/page-shortcodes/index.md
@@ -717,12 +717,14 @@ pre.terminal-out {
{{< w3-code >}}
{{</* res-figure "." "img/pixabay.com/penguin-21*" />}}
{{< res-figure "." "img/pixabay.com/penguin-21*" "Fit" "200x200" />}}
-{{< res-figure "." "img/pixabay.com/penguin-21*" "Fill" "200x200" /*/>}}
+{{< res-figure "." "img/pixabay.com/penguin-21*" "Fill" "200x200" />}}
+{{< res-figure path="." match="img/pixabay.com/penguin-21*" href="https://google.com" /*/>}}
{{< /w3-code >}}
{{< res-figure "." "img/pixabay.com/penguin-21*" />}}
{{< res-figure "." "img/pixabay.com/penguin-21*" "Fit" "200x200" />}}
{{< res-figure "." "img/pixabay.com/penguin-21*" "Fill" "200x200" />}}
+{{< res-figure path="." match="img/pixabay.com/penguin-21*" href="https://google.com"/>}}
```yaml
resources:
@@ -751,6 +753,7 @@ resources:
| cmd | 2 | Resize | command | Fill, Fit or Resize |
| opt | 3 | 300x | options | command options |
| cap | 4 | %%N | caption format | see below |
+| href | 5 | | url when clicked | |
diff --git a/layouts/shortcodes/res-figure.html b/layouts/shortcodes/res-figure.html
index 1a7f079..3eeaf18 100644
--- a/layouts/shortcodes/res-figure.html
+++ b/layouts/shortcodes/res-figure.html
@@ -18,7 +18,8 @@
{{- $.Scratch.Set `theCommand` (.Get `cmd` ) }}
{{- $.Scratch.Set `theOptions` (.Get `opt` ) }}
{{- $.Scratch.Set `theCaption` (.Get `cap` ) }}
-{{- else }}
+ {{- $.Scratch.Set `theHref` (.Get `href` ) }}
+ {{- else }}
{{- $myPos := 0}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set `theResPagePath` (.Get $myPos) }} {{end}}
{{- $myPos := 1}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set `theMatch` (.Get $myPos) }} {{end}}
{{- $myPos := 2}} {{ if gt (len .Params) $myPos }} {{$.Scratch.Set `theCommand` (.Get $myPos) }} {{end}}
@@ -100,10 +101,16 @@
{{- $myImage := $.Scratch.Get `myImageConverted` }}
<figure class='res-figure no-photoswipe' style="width: {{ $myImage.Width }}px;">
+ {{- if ($.Scratch.Get `theHref`) }}
+ <a class="no-decoration" target="blank" href="{{$.Scratch.Get `theHref`}}">
+ {{- end }}
<img src="{{ $myImage.RelPermalink }}"
alt="{{ $myCapFileName }}"
width="{{ $myImage.Width }}" height="{{ $myImage.Height }}"
>
+ {{- if ($.Scratch.Get `theHref`) }}
+ </a>
+ {{- end }}
<figcaption class='res-figcaption'>
{{- with $.Inner }}
{{- . | markdownify }}
diff --git a/layouts/shortcodes/w3-col-youtube.html b/layouts/shortcodes/w3-col-youtube.html
new file mode 100644
index 0000000..c0fa78f
--- /dev/null
+++ b/layouts/shortcodes/w3-col-youtube.html
@@ -0,0 +1,26 @@
+{{- range $index, $ytList := (seq 0 (sub (len .Params) 1) ) }}
+ {{- if eq (mod $index 3) 0 }}
+<div class="w3-row-padding ">
+ {{- end }}
+ <div class="w3-col m4 ">
+ <div class="w3-card-4 w3-padding-small w3-center w3-theme-l3 ">
+ {{/* https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/youtube.html */}}
+ {{- $pc := $.Page.Site.Config.Privacy.YouTube -}}
+ {{- if not $pc.Disable -}}
+ {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
+ {{- $id := $.Get $index -}}
+ <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;" >
+ <iframe
+ src="https://{{ $ytHost }}/embed/{{ $id }}"
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;"
+ allowfullscreen >
+ </iframe>
+ </div>
+ {{ end -}}
+ </div>
+ </div>
+ {{- if or (eq (mod $index 3) 2) (eq $index (sub (len $.Params) 1 )) }}
+</div>
+<p>
+ {{- end }}
+{{- end }}