Template files no longer added to /public folder

Hi folks!

I have a site with a few different “foo.json”, “bar.json” templates under the /layouts folder which use jsonify to produce proper JSON files, which can then be read from JS for indexing purposes. These were published under the /public directory when running hugo server with v0.122.1, but that no longer happens with hugo v0.152.2 and I have no idea how to get it back working.

I followed this page for migrating the other layouts, so this is the last remaining bit I can’t figure out. Any help much appreciated (note I’m a Hugo newbie) :folded_hands:

Share your code. See: Requesting Help

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Just pushed the code here: GitHub - gvolpe/newsite

You need to define output formats for your JSON files.

[outputs]
  home = ["HTML", "RSS", "HOME"]
  section = ["HTML", "RSS", "LIST"]
  page = ["JSON", "PAGES"]

[outputFormats]
  [outputFormats.HOME]
    baseName                = "home"
    mediaType               = "application/json"
    isPlainText             = true
  [outputFormats.PAGES]
    baseName                = "pages"
    mediaType               = "application/json"
    isPlainText             = true
  [outputFormats.LIST]
    baseName                = "list"
    mediaType               = "application/json"
    isPlainText             = true
1 Like

Thanks, that worked!

1 Like

I edited my previous comment to add the others.

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