New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ksluder opened this Issue Jun 29, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@ksluder

ksluder commented Jun 29, 2018

Copied by request from the Discourse forum:

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?

index.json file attached.

index.json.txt

@bep bep added the Bug label Jun 29, 2018

@bep bep self-assigned this Jun 29, 2018

@bep bep added this to the v0.43 milestone Jun 29, 2018

bep added a commit to bep/hugo that referenced this issue Jul 6, 2018

hugolib: Do not create paginator pages for the other output formats
This is a recent regression in Hugo, where we have started to produce `/page/30/index.json` when the main output format (usually `HTML`) is set up with pagination.

For JSON this is potentially lot of superflous work and hurts performance.

This commit reinstates the earlier behaviour: We only create paginators if in use in the main output format.

And add a test for it to prevent this from happening again.

Fixes gohugoio#4890

@bep bep closed this in #4905 Jul 6, 2018

bep added a commit that referenced this issue Jul 6, 2018

hugolib: Do not create paginator pages for the other output formats
This is a recent regression in Hugo, where we have started to produce `/page/30/index.json` when the main output format (usually `HTML`) is set up with pagination.

For JSON this is potentially lot of superflous work and hurts performance.

This commit reinstates the earlier behaviour: We only create paginators if in use in the main output format.

And add a test for it to prevent this from happening again.

Fixes #4890
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment