From 40908cb3c30c01089b2750c795681d78d899cb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sun, 10 Mar 2024 11:02:47 +0000 Subject: [PATCH] fixed youtube performance issues and added new shortcut --- exampleSite/content/_index.md | 3 +- exampleSite/content/docs/shortcodes/index.md | 31 +++++--------------- layouts/shortcodes/youtubeLite.html | 14 ++------- 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index b8c1ad74..2080b105 100755 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -9,8 +9,7 @@ Welcome to Blowfish, one of the most flexible and robust Hugo themes. It is desi npx blowfish-tools ``` - - +{{< youtubeLite id="SgXhGb-7QbU" label="Blowfish-tools demo" >}} @@ -735,35 +735,20 @@ consectetur adipiscing elit. ## Youtube Lite -tbd - -https://github.com/paulirish/lite-youtube-embed - - +A shortcut to embed youtube videos using the [lite-youtube-embed](https://github.com/paulirish/lite-youtube-embed) library. This library is a lightweight alternative to the standard youtube embeds, and it's designed to be faster and more efficient. -| Parameter | Description | -| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -| `tag` | [String] `html` tag that will be used to render the strings. | -| `classList` | [String] List of `css` classes to apply to the `html` element. | -| `initialString` | [String] Initial string that will appear written and will be replaced. | -| `speed` | [number] Typing speed, measured in milliseconds between each step. | -| `lifeLike` | [boolean] Makes the typing pace irregular, as if a real person is doing it. | -| `startDelay` | [number] The amount of time before the plugin begins typing after being initialized. | -| `breakLines` | [boolean] Whether multiple strings are printed on top of each other (true), or if they're deleted and replaced by each other (false). | -| `waitUntilVisible` | [boolean] Determines if the instance will begin when loaded or only when the target element becomes visible in the viewport. The default is `true` | -| `loop` | [boolean] Whether your strings will continuously loop after completing | - +| Parameter | Description | +| --------- | ----------------------------------- | +| `id` | [String] Youtube video id to embed. | +| `label` | [String] Label for the video | **Example 1:** ```md -{{}} -Lorem ipsum dolor sit amet -{{}} +{{}} -SgXhGb-7QbU ``` -{{< youtubeLite />}} +{{< youtubeLite id="SgXhGb-7QbU" label="Blowfish-tools demo" >}} diff --git a/layouts/shortcodes/youtubeLite.html b/layouts/shortcodes/youtubeLite.html index 8817dc67..398f9f79 100644 --- a/layouts/shortcodes/youtubeLite.html +++ b/layouts/shortcodes/youtubeLite.html @@ -1,12 +1,4 @@ -{{- $content := split .Inner "\n" -}} -{{- $initialString := .Get "initialString" | default "" -}} -{{- $speed := .Get "speed" | default 100 -}} -{{- $lifeLike := .Get "lifeLike" | default false -}} -{{- $startDelay := .Get "startDelay" | default 0 -}} -{{- $breakLines := .Get "breakLines" | default true -}} -{{- $waitUntilVisible := .Get "waitUntilVisible" | default true -}} -{{- $loop := .Get "loop" | default false -}} +{{- $id := .Get "id" | default "SgXhGb-7QbU" -}} +{{- $label := .Get "id" | default "Blowfish" -}} - - - +