is there a reason why I need to reference the file created by resources.ExecuteAsTemplate to get the file written to the file system during the build? I use it to create Json files that are used by some JavaScript so I would not need to incude/load/reference the json file in the HTML.
I would expect that the file is always written to search/config.json but without the “fake” reference using an HTML comment like <!-- {{ $searchConfig.Permalink }} --> the file is not written to the file system…
What makes this even more confusing, this behavior is not documented, and the build passed without a warning or an error. Personally, I spend some time to figure out why the file is not available in the public folder after build.
For example some may be outputted inline, others may be converted to different file formats.
Publishing without an explicit reference would be kind of limiting, as in some cases the resource may need to be manipulated and it may be undesirable to have it published by default when for example .ExecuteAsTemplate is called.
Also note that on top of invoking the .Permalink or .RelPermalink of a Resource there is also an undocumented .Publish method.
Ah, good to know. Searching for hugo ExecuteAsTemplate will lead you to Creating a resource from template | Hugo what makes it a bit hard to find on the page mentioned by you.