Skip to content
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 · 1 comment · Fixed by #4905
Closed

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

ksluder opened this issue Jun 29, 2018 · 1 comment · Fixed by #4905
Assignees
Milestone

Comments

@ksluder
Copy link

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
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 as completed in #4905 Jul 6, 2018
bep added a commit that referenced this issue Jul 6, 2018
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
@github-actions
Copy link

github-actions bot commented Mar 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants