I have been unable to have the files in the code-examples be copied over to the public folders.
I’m sure I am missing something, especially since it use to work before. I went through several support articles and peruse the documentation but could not find how to make it work.
There was an intentional breaking change in v0.123.0. Page resources with ResourceType “page” are no longer copied to the public directory when building your site.
There are a few ways to handle this depending on what you’re trying to do.
If you just want to blindly copy the file you can place it in the static directory:
Thanks a lot for your answer. I looked at the release notes but did not spot the change. My mistake.
Yes I could do what you’re describing, but I was wondering if there were other solutions. I would like to avoid moving these files away from the blog posts.
My blog posts are mainly technical and about writing code, so I used HTML pages as a way to show the code in action, just like a codepen would, with the simplicity of a link. So they are very contextual to the blog post, just like an image would.
If I have no other choice but to mirror my blog posts file tree and update my links, I will do that.
Maybe I could provide you with a link to explain better what I’m trying to do.
Here is an blog post that uses these HTML files alongside a Markdown file.
There are already code blocks with the code that is on the HTML page. So including the content of the HTML page would not be necessary. The HTML page is just there to act as a run button for the code present on the page. Hopefully I’m making sense
{{ with .Get 0 }}
{{ with $.Page.Resources.Get . }}
{{ with .Content | resources.FromString (.Path | relLangURL) }}
<a href="{{ .RelPermalink }}">{{ .RelPermalink }}</a>
{{ end }}
{{ else }}
{{ errorf "The %q shortcode was unable to find %s. See %s" $.Name ($.Get 0) $.Position }}
{{ end }}
{{ else }}
{{ errorf "The %q shortcode requires a positional parameter, the page to the page resource. See %s" .Name .Position }}
{{ end }}
Try it:
git clone --single-branch -b hugo-forum-topic-50356 https://github.com/jmooring/hugo-testing hugo-forum-topic-50356
cd hugo-forum-topic-50356
hugo server