Companion page-bundle HTML files not being copied to subfolder of output directory anymore

TLDR: The new behavior is expected/as-designed.

Example

Let’s use the following example to see the difference between v0.122.0 and v0.123.0.

content/
└── p1/
    ├── a.jpg
    ├── b.html
    ├── c.md
    └── index.md

v0.122.0 (incorrect)

Available as a page resource Published (copied to public)
content/p1/a.jpg :heavy_check_mark: :heavy_check_mark:
content/p1/b.html :heavy_check_mark: :heavy_check_mark:
content/p1/c.md :heavy_check_mark: :x:

v0.123.0 (correct)

Available as a page resource Published (copied to public)
content/p1/a.jpg :heavy_check_mark: :heavy_check_mark:
content/p1/b.html :heavy_check_mark: :x:
content/p1/c.md :heavy_check_mark: :x:

Explanation

In v0.122.0 and earlier we inconsistently handled page resources with ResourceType = page. As shown in the v0.122.0 example above, we did not copy c.md, but we did copy b.html. That inconsistent behavior was fixed in v0.123.0.

I understand that some site authors took advantage of this inconsistent and undocumented behavior to blindly copy HTML files when building the site. That, obviously, is no longer possible. Here are your options going forward.

Option A – Use the static directory

static/
└── p1/
    └── b.html

Option B – Use the Publish method

layouts/_default/single.html

1) This will publish all page resources with ResourceType = page.

{{ range .Resources.ByType "page" }}
  {{ $publishPath := urls.JoinPath $.RelPermalink .Name }}
  {{ (.Content | resources.FromString $publishPath).Publish }}
{{ end }}

2) This will publish all page resources with an html extension:

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