From 95907a2b5f7e4ee32e1f05978a43a92cdfc7c6b9 Mon Sep 17 00:00:00 2001
From: Deepak Khatri <lorforlinux@beagleboard.org>
Date: Tue, 2 May 2023 00:10:28 +0530
Subject: [PATCH] How to add YouTube videos correctly?

This sections provides good reference on how to add a YouTube video correctly to both HTML and PDF versions of docs.
---
 intro/contribution/rst-cheat-sheet.rst | 35 ++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/intro/contribution/rst-cheat-sheet.rst b/intro/contribution/rst-cheat-sheet.rst
index d464d396..2da33b15 100644
--- a/intro/contribution/rst-cheat-sheet.rst
+++ b/intro/contribution/rst-cheat-sheet.rst
@@ -298,6 +298,41 @@ label for this chapter. These are called the explicit links amd you can referenc
 
 When rendered it becomes :ref:`rst-cheat-sheet`.
 
+YouTube Videos
+==============
+
+This section shows you the typical way of adding a YouTube video to 
+docs.BeagleBoard.org in a way that you see on page playable embedded 
+YouTube video when you look at HTML version of the docs and only a 
+clicable thumnail linked to the YouTube video when you see the PDF. 
+
+.. callout::
+
+    .. code-block:: rst
+
+        .. only:: latex
+            
+            .. image:: https://img.youtube.com/vi/<YouTube_video_ID>/maxresdefault.jpg <1>
+                :alt: BeagleConnect unboxing YouTube video
+                :width: 1280
+                :target: https://www.youtube.com/watch?v=<YouTube_video_ID> <2>
+
+        .. only:: html
+
+            .. raw:: html
+
+                <iframe style="display: block; margin: auto;" width="1280" height="720" style="align:center" 
+                src="https://www.youtube.com/embed/<YouTube_video_ID>" <3>
+                title="YouTube video player" 
+                frameborder="0" 
+                allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" 
+                allowfullscreen>
+            </iframe>
+    
+    .. annotations::
+
+        <1> <2> <3> Here you have to replace the <YouTube_video_ID> with your actual youtube ID.
+
 More
 ====
 
-- 
GitLab