How to embbed a local html in a hugo post: specify the location of the html file

Viewed 35

I'm trying to embed a local html file (as an iframe) in a hugo post however I don't quite understand where the html file should be placed.

In a similar post the following code is mentioned but I'm confused about the location of the program folder

---
title : "Hello World"
summary : "Simple program"
url : "program/helloworld"
--- 
<iframe width="100%" height="150" name="iframe" src="dashboard.html"></iframe>

On another post the following solution is described however, it is not clear where should the second part be placed (inside the markdown file or is it a shortcode) nor whether the target_asset_name should include only the file name (with extension) or it can be a subfolder within the iframe_assests_root

---
iframeSource: "target_asset_name"
---

{{- $srcurl := (print .Site.BaseURL "iframe_assests_root/" .Params.iframeSource "/") -}}
<iframe src="{{- $srcurl -}}"></iframe>

I would greatly appreciate if anybody could provide a more specific example on any of the above answers. Thanks...

1 Answers
---
title : "Hello World"
summary : "Simple program"
url : "program/helloworld"
--- 
<iframe width="100%" height="150" name="iframe" src="dashboard.html"></iframe>

The code above means that your parent page is at https://www.yourdomain.com/program/helloworld (the 'url'). In this situation the 'dashboard.html' file should be placed in your 'static' directory, that lives in the root of your project.

Related