Cache manifest

Hello,

I would like to generate an appcache manifest file with Hugo 0.18 for the static content. The problem is, that a manual writing of the cache file is difficult, because if a file is missing, the cache file will be ignored, so it is a good choice, that during generating the page content, the cache file is also generated. So how can I create a template which writes a plain-text output?

Thanks

This has been discussed on this forum. There is a search function.

I have found only this posting, but there is no solution. I have tried also an ace template, because I can set a doctype, but this idea does not work.

So can I put some code into my template which is run, if Hugo is started? In my I case I need a (template) file which creates a plaintext file based on the static content, so I would like to iterate over all files within the static folder and write it to this plaintext file. Is there a possibility to execute any code?

Just an idea: how you tried to create an Hugo template page without any HTML (but just the Hugo template code), and then rename that .html file to .text? (Or whichever file extension you need).

That approach is the same approach as other users use when creating a JSON search index (see step 2 from this topic).

You don’t have to rename it, just set it in the frontmatter: “url: mytextfile.txt”