From a91f59280bbbe42913f8708622c6e2ece2d0aa2d Mon Sep 17 00:00:00 2001
From: Ray <rwstorer@hotmail.com>
Date: Sun, 11 Jun 2023 03:08:46 +0000
Subject: [PATCH] named vs positional
---
layouts/shortcodes/liteyoutube.html | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/layouts/shortcodes/liteyoutube.html b/layouts/shortcodes/liteyoutube.html
index 0364c24..8bcb6fc 100644
--- a/layouts/shortcodes/liteyoutube.html
+++ b/layouts/shortcodes/liteyoutube.html
@@ -1,11 +1,13 @@
-{{ if .IsNamedParams }} <!-- check if using named parameters or not -->
+{{ if .IsNamedParams }}
{{ $videoid := .Get "videoid" }} <!-- required. -->
{{ $img := .Get "img" }} <!-- not required. The initial background image instead of a generated one. -->
{{ $params := .Get "params" }} <!-- not required. List of params here: https://developers.google.com/youtube/player_parameters -->
+ {{ with $img }} {{ $bkImg := absURL (printf "images/%s" $img) }} {{ end }}
+ <lite-youtube videoid="{{$videoid}}"{{ with $bkImg }} style="background-image: url('{{ . }}')"{{ end }}{{ with $params }} params="{{ . }}"{{ end }}></lite-youtube>
{{ else }}
{{ $videoid := .Get 0 }} <!-- required. -->
{{ $img := .Get 1 }} <!-- not required. The initial background image instead of a generated one. -->
{{ $params := .Get 2 }} <!-- not required. List of params here: https://developers.google.com/youtube/player_parameters -->
+ {{ with $img }} {{ $bkImg := absURL (printf "images/%s" $img) }} {{ end }}
+ <lite-youtube videoid="{{$videoid}}"{{ with $bkImg }} style="background-image: url('{{ . }}')"{{ end }}{{ with $params }} params="{{ . }}"{{ end }}></lite-youtube>
{{ end }}
-{{ with $img }} {{ $bkImg := absURL (printf "images/%s" $img) }} {{ end }}
-<lite-youtube videoid="{{$videoid}}"{{ with $bkImg }} style="background-image: url('{{ . }}')"{{ end }}{{ with $params }} params="{{ . }}"{{ end }}></lite-youtube>
\ No newline at end of file
--
Gitblit v1.10.0