Output Generated JSON and XML Files from Template

Can I use templates to generate non-standards metadata JSON and XML files which are part of the site?

Sure. Check the documentation: Custom Output Formats.

For JSON and XML do I have to do anything additional than just putting the file into the layouts directory? The names of the file are not standard. It can be abc.json and xyz.xml where abc and xyz can be any file name.

Though Custom Output Formats mentions standard files and supported formats. It is not clear to me if I need to to do anything extra for non-standard files.

You kinda answered it yourself. Check this: Add custom sitemap.

Also, you didn’t tell exactly how you’re using those files, so it could go in the site configuration or some page(s) front matter, but that’s also covered in the documentation.

Why do you need "HTML", "SITEMAP" part:

If this is omitted what will happen?

I want all standard outputs like the HTML files, robot text, default sitemaps, rss, etc.

There are standards build in, all other must be defined.
Redefinitions give me the control.

My concern is if I define a custom output format will the standard outputs stop working if I don’t explicitly mention them?

If this is not the case can I just say

[outputs]
    home                   = ["SITEMAP2"]

in the example, you have given, as "HTML", "SITEMAP" are standard, hence without mentioning they you still get the output?

If I have to explicitly mention the standard outputs also if I am defining a custom output, what is and exhaustive list of standard outputs to mention.

You still didn’t tell what are those JSON and XML files you want to render, so there’s no way we can point you an exact direction…

Is it even sitewide?

I am trying to generate site.webmanifest, manifest.json and browserconfig.xml files.

Right. So, single files, root directory. @ju52 example still applies. Just place your 3 custom formats like that and they’ll be rendered as they should, as single files in the root directory.

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