# Error youtube shortcode

**URL:** <https://discourse.gohugo.io/t/error-youtube-shortcode/46768>\
**Category:** support\
**Created:** [October 22, 2023, 10:04am UTC](https://discourse.gohugo.io/t/error-youtube-shortcode/46768 "2023-10-22T10:04:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [October 22, 2023, 10:04am UTC](https://discourse.gohugo.io/t/error-youtube-shortcode/46768/1 "2023-10-22T10:04:24Z")

</div>

Hi!  
I have the following `youtube.html` shortcode under `/layout/shortcodes/`:

```auto
<div class="embed video-player">
<iframe class="youtube-player" type="text/html" width="800" height="400" src="https://www.youtube-nocookie.com/embed/{{ index .Params 0 }}" allowfullscreen frameborder="0">
</iframe>
</div>

```

I set into a page (md file) the following:

`{{< youtube string >}}` where the string is the value after v on YouTube.

It worked, and I don’t know what happened, but on the web page, a box appears as the image I attached.

 ![sshot_2023-10-22_12.00.43](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/1/4/14c0af7dd52366546852209dbfb3cb72013affaf.png)

The webpage is [About me | NicFab Notes](https://notes.nicfab.eu/en/pages/about/#things-i-love).  
I don’t see any error from the console.  
Any help?

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [October 22, 2023, 10:55am UTC](https://discourse.gohugo.io/t/error-youtube-shortcode/46768/2 "2023-10-22T10:55:03Z")

</div>

Trying with other YouTube videos, I realized it depends on the video.  
It works by using other videos.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [October 22, 2023, 3:43pm UTC](https://discourse.gohugo.io/t/error-youtube-shortcode/46768/3 "2023-10-22T15:43:47Z")

</div>

The video’s uploader can set if they want the video to be available to embeds. Also if the video is set to private you might not be able to use it. The error points to one of these cases.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [October 24, 2023, 3:44pm UTC](https://discourse.gohugo.io/t/error-youtube-shortcode/46768/4 "2023-10-24T15:44:19Z")

</div>

Closed on October 24, 2023, 3:44pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
