Example of new custom outputs

So I was pretty excited about the new custom output stuff in 0.20, but maybe I got too excited too quickly. :wink:

I thought this update would simplify creating dynamic pages in non-HTML format. So for example. I want /foo.json to to be a JSON array of the last 5 pages created.

I thought I could go into /content, make a new file, foo.json, and include Go language inside. I did that, but the template stuff isnā€™t being parsed. I even added front matter, but it didnā€™t work.

So what am I missing?

It seems that you try to brute-force your way into this new feature, which I guess can take some time.

Have you looked at the documentation?

Also, the recent commits on my blog should give you some insight.

As to examples, Iā€™m sure the community will provide lots of them, as soon as the paint dries.

Yep, I did read the docs. It doesnā€™t seem to explain how one would create a file w/ custom logic (again, using the Go syntax) to spit out something thatā€™s not HTML. Is it indeed possible?

Yes it is.

Alright - so given /content/foo.json, can you confirm that I need front matter in order for it to be parsed and just not copied over? Could you maybe show a simple example of just outputting one variable in the JSON?

Can you point to where in the documentation is says that you should put a JSON file or similar inside /content? That would be good to fix, as that would create confusion.

As to examples, if you need anymore than whatā€™s provided, you will have to wait for others to chime in.

Err, well, no, it doesnā€™t say to do that.

Maybe Iā€™m just confused then. My read on this new feature was that I could create a template that was dynamic (locally of course) that would be built static and would allow for things like a custom JSON file, or some such.

Is that not true? If so, then how is it done? Iā€™m not asking for a large demo, even something as simple as:

{ ā€œsiteNameā€: ā€œthis would be dynamic based on site nameā€}

That should be a trivial example, right? (Assuming Iā€™m reading the docs right.)