Some HTML files get lost, how to force them?

Recently I found some html files are not lendered by hugo, like above.

Of course the html files in static are copied but I want to lender all html files in normal content folders when I use iframe tag. For now I avoid these by ‘renaming’: ① just save example.html as example.fig, ② <iframe scr="example.fig"> ③ It works, but unhappy :sob:

I’m using hugo v0.136.0 and I know there is no flag exactly same to --forceSyncStatic, but I believe there are other approach, for example, hugo.toml. Is it?

Breaking change in hugo 0.123
a html file in a bundle is a page resource and now page resources won’t be copied consistently.

you will have to manually publish your html files in the called template (usually single.html)

{{ range .Page.Resources.Match "**.html" }}
  {{ $publishPath := urls.JoinPath $.RelPermalink .Name }}
  {{ (.Content | resources.FromString $publishPath).Publish }}
{{ end }}

Solution taken from:

1 Like

A better way to describe this…

With v0.123.0 and later, a page resource with a ResourceType of page is not published.

A leaf bundle with resources might look like this:

content/
├── example/
│   ├── a.md      <-- resource type = page
│   ├── b.html    <-- resource type = page
│   ├── c.adoc    <-- resource type = page
│   ├── d.pdc     <-- resource type = page
│   ├── e.rst     <-- resource type = page
│   ├── f.org     <-- resource type = page
│   ├── g.jpg     <-- resource type = image
│   ├── h.mp4     <-- resource type = video
│   └── index.md  <-- the content
└── _index.md

In the above, g.jpg and h.mp4 are published[1], while the others are not.

We don’t publish page resources with a ResourceType of page because these resources are typically used to contain content that will be included within a page (i.e., snippets).

Here’s a related issue, which I suspect will die of neglect:
https://github.com/gohugoio/hugo/issues/12274


  1. You can change this behavior by setting build.publishResources = false in front matter. See https://gohugo.io/content-management/build-options/. ↩︎

1 Like

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