From f7396f1edb0b52689dcd0a0674a84c40c40440e3 Mon Sep 17 00:00:00 2001
From: Ray <rwstorer@hotmail.com>
Date: Sun, 11 Jun 2023 02:13:01 +0000
Subject: [PATCH] with and no params
---
layouts/shortcodes/liteyoutube.html | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/layouts/shortcodes/liteyoutube.html b/layouts/shortcodes/liteyoutube.html
index 460d627..b2b4f6c 100644
--- a/layouts/shortcodes/liteyoutube.html
+++ b/layouts/shortcodes/liteyoutube.html
@@ -1,7 +1,11 @@
-{{ $videoid := .Get "videoid" }}
-{{ $params := .Get "params" }} <!-- not required. List of params here: https://developers.google.com/youtube/player_parameters -->
-{{ $img := .Get "img"}} <!-- not required. The initial background image instead of a generated one. -->
-{{ if $img }}
- {{ $bkImg := absURL (printf "images/%s" $img) }}
+{{ if .IsNamedParams }} <!-- check if using named parameters or not -->
+ {{ $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 -->
+{{ 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 -->
{{ end }}
-<lite-youtube videoid="{{$videoid}}"{{ if $img }} style="background-image: url('{{$bkImg}}')"{{ end }}{{ if $params }} params="{{$params}}"{{ end }}></lite-youtube>
\ No newline at end of file
+{{ $bkImg := absURL (printf "images/%s" $img) }}
+<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