How to use tags in a content item

I’m trying to output some data in a JSON page. A data file exists data/data.yml. I have content/data.json with the contents:


{{ }}

which is just outputted as raw. I’m trying this approach as I’ve come to Hugo from a Jekyll background.


Trying that now, quite a few features seem hidden right at the bottom of the docs menu.

Hugo doesn’t seem to want to parse the .json file. Any suggestion for this?

OK, I misread your original question.

Content files in Hugo are Markdown files (with a set of extensions for some engines, md being the standard) or HTML.

JSON files are not content files (they can be used as data files, but that is another chapter in the docs).

File format really doesn’t matter, as with HTML Hugo doesn’t need to process it. Is there a setting to get it to process the file? The Jekyll method is any text file with frontmatter gets processed (CSS, JS, JSON can all be done).

Hugo doesn’t process it, which is what you see. Files in /content that isn’t content files (as defined by their suffix) gets copied as-is.

Hugo isn’t Jekyll.

I am aware, it’s just my only reference point.

Is it impossible to output anything other than HTML with Hugo?

No. You can set the url in frontmatter with an extension – so you can output anything, but it is a little exotic – Hugo is a HTML generator at its core.

@wjdp You can create a layout and use jsonify to get the desires output, then it’s just a matter of changing the extension in a bash script. Not technically 100% Hugo, but it will get you 98% of the way there.

This is cleaner:

Not sure if this is what you’re looking for, but skilstak’s tutorial gave me some ideas on setting Hugo up to be more “data-centric” versus the standard “content-centric


@bep I failed to look more closely at the above commit. So is that you can use your above method allows Hugo to write directly to a .json file? So I can create an HTML template and write to .json as long as I change url: in the front matter?

Yes. The Hugo server even understands the json mime type.