# Iframe content is empty

**URL:** <https://discourse.gohugo.io/t/iframe-content-is-empty/28720>\
**Category:** support\
**Created:** [October 8, 2020, 12:10pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720 "2020-10-08T12:10:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cloud-Forge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cloud-forge/32/10480_2.png) [@Cloud-Forge](https://discourse.gohugo.io/u/Cloud-Forge)\
**Post date:** [October 8, 2020, 12:10pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/1 "2020-10-08T12:10:12Z")

</div>

Hi there,

I am trying to display an **iframe** on my hugo site.  
But no matter what I do, the **head** and **body** elements are empty.  
They are not getting generated at build time.

I have tried several approaches, that I have found in this very place :  
`https://discourse.gohugo.io/search?q=iframe`

in particular : `https://discourse.gohugo.io/t/generate-iframe-source-in-template/15654`

1. I have tried with a shortcode with my iframe inside.
2. I have tries to use a partial that’s get called from a shortcode.

in .md file :

> {{\< part1/sc\_iframe \>}}

in part1/sc\_iframe :

> {{ partial “iframe.html” . }}

in shortcode iframe.html

```
<iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="https://www.strava.com/activities/2330518629/embed/bc0c587811e9409ef8084daa68114e54acb47286">
</iframe>

```

The iframe is still emplty.

What I am doing wrong ?

Thanks.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 8, 2020, 12:34pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/2 "2020-10-08T12:34:53Z")

</div>

I’m unable to reproduce the problem. Check your directory structure:

```auto
layouts/
├── _default
│ ├── baseof.html
│ ├── list.html
│ └── single.html
├── partials
│ └── iframe.html
└── shortcodes
    └── part1
        └── sc_iframe.html

```

layouts/shortcodes/part1/sc\_iframe.html

```auto
{{ partial "iframe.html" . }}

```

layouts/partials/iframe.html

```auto
<iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="https://www.strava.com/activities/2330518629/embed/bc0c587811e9409ef8084daa68114e54acb47286">
</iframe>

```

---

<div class="post-metadata">

**Author:** ![Cloud-Forge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cloud-forge/32/10480_2.png) [@Cloud-Forge](https://discourse.gohugo.io/u/Cloud-Forge)\
**Post date:** [October 8, 2020, 1:06pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/3 "2020-10-08T13:06:36Z")

</div>

I have the same structure as you do.  
And I forgot to mention that I have :

- [markup.goldmark.renderer]  
unsafe= true

- Hugo Version : 0.75.1-1

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 8, 2020, 1:20pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/4 "2020-10-08T13:20:06Z")

</div>

Still unable to reproduce the problem.

> Include a **link to the source code repository** of your project, because we really need the _context_ of seeing your templates and partials to be able to help you. It is trivial to do a quick `git clone` on your repo, then run `hugo server` in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
> 
> If you can’t share your repository for whatever reason, consider creating a dummy repo that you _can_ share, which reproduces the problem you’re experiencing.

---

<div class="post-metadata">

**Author:** ![Cloud-Forge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cloud-forge/32/10480_2.png) [@Cloud-Forge](https://discourse.gohugo.io/u/Cloud-Forge)\
**Post date:** [October 8, 2020, 1:48pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/5 "2020-10-08T13:48:03Z")

</div>

you are right :

here is a fresh repo with a fresh hugo generated site with the uncooperative **iframe** :

> **[Cloud-Forge/hugo\_sandbox](https://github.com/Cloud-Forge/hugo_sandbox)**
>
> Contribute to Cloud-Forge/hugo\_sandbox development by creating an account on GitHub.

You’ll find the iframe inside :

[http://localhost:1313/post/test\_iframe/](http://localhost:1313/post/test_iframe/)

---

<div class="post-metadata">

**Author:** ![Cloud-Forge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cloud-forge/32/10480_2.png) [@Cloud-Forge](https://discourse.gohugo.io/u/Cloud-Forge)\
**Post date:** [October 8, 2020, 2:04pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/6 "2020-10-08T14:04:04Z")

</div>

**Hold on !**

I was working on Firefox and out of an hunches I tried on Brave and it works !

Firefox version : 81.0 (64-bit)  
Brave : [Version 1.12.105 Chromium: 84.0.4147.105 (Official Build) unknown (64-bit)](https://brave.com/latest/)

~~So my iframes are not working on FF ( **I have all security modules deactivated on FF / Localhost** )~~

**Nope, I was wrong again, it was Ghostery that wasn’t properly deactivated for localhost:1313**

So thanks a lot **jmooring** , our exchange solved my problem in a way 🙂

---

<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 8, 2020, 2:19pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/7 "2020-10-08T14:19:31Z")

</div>

Check your browser console. Most browsers have that by clicking right button on your page, then select “Inspect”. In the console you will see errors. I am pretty sure something along the lines of CSP will come up or something like “not found”. The empty head/body tags are a workaround of your browser to show “nothing”.

---

<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 10, 2020, 2:19pm UTC](https://discourse.gohugo.io/t/iframe-content-is-empty/28720/8 "2020-10-10T14:19:37Z")

</div>

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