How to enable JSON endpoints for all tags or all categories

We have two taxonomies on

The data for these are stored here:

What is the best way to build or enable JSON endpoints for all tags or all categories on a HUGO site?

I can’t tell if I am

  • naming the template files wrong
  • not understanding the path where they’d be visible
  • not configuring them in the config.yml correctly

Any thoughts?

Hey @jeremyzilar I really like the digitalgov site. Just so I’m clear, which are you trying to do?

  1. Use Hugo’s taxonomies (i.e. tags: and categories inside frontmatter in content files) to write to a single .json file (e.g., or…
  2. Incorporate non-Hugo/external data from the yaml files into a json file?

Hey @rdwatters — Thank you for replying.

I need a json endpoint that lists all the tags, and a separate file that lists all of the categories (as JSON).

For example:

Here are all our JSON API endpoints:
You can see that a few of them are not working at the moment.

I think I just figured it out.

I had to create “pages” that included a shortcode, and each page needed to call a specific layout.

Here is the /tag/ example:

The final output will put the JSON feed at

I had to add in /v1/ into the path since we actually have JSON as a tag.

Is there any way to get the correct content encoding HTTP headers?

Good question @eberkund. I was just coming here to look up how to set the headers in JSON files in HUGO. I am not seeing how that can be done (yet)