在 hugo post 中 Iframe 一个 HTML 文件

Iframe an HTML file in a hugo post

我有一个 hugo post,其前言和内容如下

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

要求将 HTML 文件呈现为 iframe,这不是针对一个 post,而是针对许多 post,而 HTML 文件在 post 中呈现会因 post 而异。例如,它会类似于下面的front matter and content for another post,

---
title : "Hello Calc"
summary : "Simple program"
url : "program/calc"
--- 
<iframe width="100%" height="150" name="iframe" src="operations.html"></iframe>

HTML文件到iframe的位置位于myblog/content/posts/helloworld/dashboard.html.问题是,HTML 文件未在 post.

中呈现

唯一需要更改的是配置。toml/config.yml。由于这是一个不安全的操作,因此必须在配置文件中定义它。 index.md

+++
title = "Helloworld"
date = 2021-03-11T21:43:30-08:00
draft = false
url = "program/helloworld"
+++

<iframe width="100%" height="150" name="iframe" src="dashboard.html"></iframe>

content/posts/helloworld/dashboard.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0">
  <title>Dashboard</title>
</head>
<body>
  <p>This is content/posts/helloworld/dashboard.html.</p>
</body>
</html>

config.toml.

[markup.goldmark.renderer]
unsafe = true