Pagination behavior for Custom Output in 0.31+ vs. 0.42+

I’ve been trying to figure out some slowdowns related to generating JSON indexes as described here and noticed a difference in the way that 0.31.1 and 0.42 renders Custom Output formats. 0.31.1 produces one JSON file for the entire site.

> hugo version
Hugo Static Site Generator v0.31.1 darwin/amd64 BuildDate: 2017-11-27T06:26:26-05:00
> hugo --templateMetrics
... 
    38.678751ms   38.678751ms   38.678751ms      1  index.json
...
> ls **/index.json
layouts/index.json	public/index.json

0.42.2 renders an index.json page for every pagination page.

> ~/Downloads/hugo version
Hugo Static Site Generator v0.42.2 darwin/amd64 BuildDate: 2018-06-28T12:36:21Z
> ~/Downloads/hugo --templateMetrics
...
   5.307117485s  112.917393ms  259.236136ms     47  index.json
...
> ls **/index.json
layouts/index.json		public/page/23/index.json	public/page/38/index.json
public/index.json*		public/page/24/index.json	public/page/39/index.json
public/page/10/index.json	public/page/25/index.json	public/page/4/index.json
public/page/11/index.json	public/page/26/index.json	public/page/40/index.json
public/page/12/index.json	public/page/27/index.json	public/page/41/index.json
public/page/13/index.json	public/page/28/index.json	public/page/42/index.json
public/page/14/index.json	public/page/29/index.json	public/page/43/index.json
public/page/15/index.json	public/page/3/index.json	public/page/44/index.json
public/page/16/index.json	public/page/30/index.json	public/page/45/index.json
public/page/17/index.json	public/page/31/index.json	public/page/46/index.json
public/page/18/index.json	public/page/32/index.json	public/page/47/index.json
public/page/19/index.json	public/page/33/index.json	public/page/5/index.json
public/page/2/index.json	public/page/34/index.json	public/page/6/index.json
public/page/20/index.json	public/page/35/index.json	public/page/7/index.json
public/page/21/index.json	public/page/36/index.json	public/page/8/index.json
public/page/22/index.json	public/page/37/index.json	public/page/9/index.json

Calling jsonify seems to be expensive. Existing documentation says that pagination applies if the template specifies pagination but doesn’t specify whether it would be applied to all index pages. Pagination is referenced in index.html but not index.json. Is there a way to exclude index.json from pagination?

Thanks in advance.

This looks like a bug, and I’m a little bit curious as to how this was not discovered, I suspect it is a rather new issue. Can you create a GitHub issue about this and I will fix this? We may create a better definition in the future, but for now: The main output format (usually HTML) is the only source getting paginated output.

Thank you. I’ll file an issue on github.

That said, I will have to look into this. I assume that if you have a JSON template with a paginator, that should work.

Issue filed on github as https://github.com/gohugoio/hugo/issues/4890 , I also attached the index.json file I’ve been using.