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

Print error/warning and suggest solution if a page is rendered empty #947

Closed
anthonyfok opened this Issue Mar 5, 2015 · 10 comments

Comments

Projects
None yet
8 participants
@anthonyfok
Contributor

anthonyfok commented Mar 5, 2015

See http://discuss.gohugo.io/t/generated-post-page-is-empty-solved/835

This is one of the first hurdle that I ran into too,
and sometimes still run into when starting a new website,
or when experimenting with a new theme.

So, it would be nice if Hugo could do a quick check to see if any generated files are empty, especially public/index.html, and emit a warning/error message, and perhaps offer possible solution to the end user, e.g. check the layouts/ directory, or use a theme, etc.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Mar 5, 2015

Member

There are warning-loggings about this:

WARN: 2015/03/05 Unable to locate layout for page ...
Member

bep commented Mar 5, 2015

There are warning-loggings about this:

WARN: 2015/03/05 Unable to locate layout for page ...
@anthonyfok

This comment has been minimized.

Show comment
Hide comment
@anthonyfok

anthonyfok Mar 5, 2015

Contributor

@bep, awesome! I didn't know that! That would be a great place to start adding helpful messages for newcomers. I will hopefully look into it deeper in a week or two after I finish my paperwork, haha!

Contributor

anthonyfok commented Mar 5, 2015

@bep, awesome! I didn't know that! That would be a great place to start adding helpful messages for newcomers. I will hopefully look into it deeper in a week or two after I finish my paperwork, haha!

@yacoob

This comment has been minimized.

Show comment
Hide comment
@yacoob

yacoob Mar 11, 2015

Contributor

Conversly, hugo currently generates 0-sized files like this one just because a layout is missing. I'm not planning to add a layout for it, as I don't need that page. If empty pages is going to be an error, I'd like to get an option to kill generation of empty pages, so this kind of thing is not a generation failure.

Contributor

yacoob commented Mar 11, 2015

Conversly, hugo currently generates 0-sized files like this one just because a layout is missing. I'm not planning to add a layout for it, as I don't need that page. If empty pages is going to be an error, I'd like to get an option to kill generation of empty pages, so this kind of thing is not a generation failure.

@egorse

This comment has been minimized.

Show comment
Hide comment
@egorse

egorse Jul 31, 2015

+1 for @yacoob - the zero bytes pages are annoying. All options (warn, fatal error, or silently remove empty pages) would by nice to have.

egorse commented Jul 31, 2015

+1 for @yacoob - the zero bytes pages are annoying. All options (warn, fatal error, or silently remove empty pages) would by nice to have.

@helmbold

This comment has been minimized.

Show comment
Hide comment
@helmbold

helmbold commented Aug 17, 2015

+1

@anthonyfok anthonyfok added this to the v0.16 milestone Dec 2, 2015

@anthonyfok anthonyfok changed the title from Emit error/warning and suggested solution if a generated page is empty to Print error/warning and suggest solution if a generated page is empty Dec 2, 2015

@anthonyfok anthonyfok changed the title from Print error/warning and suggest solution if a generated page is empty to Print error/warning and suggest solution if a page is rendered empty Dec 2, 2015

anthonyfok added a commit that referenced this issue Dec 2, 2015

Print error when /index.html is zero-length
Also print warning (in verbose mode) for other empty pages.

See #947
@anthonyfok

This comment has been minimized.

Show comment
Hide comment
@anthonyfok

anthonyfok Dec 2, 2015

Contributor

Hi all,

I have just pushed a commit 0d1d33d that would output a big fat error when the home page is empty:

ERROR: 2015/12/01 =============================================================
ERROR: 2015/12/01 Your rendered home page is blank: /index.html is zero-length
ERROR: 2015/12/01  * Did you specify a theme on the command-line or in your
ERROR: 2015/12/01    "config.toml" file?  (Current theme: "")
ERROR: 2015/12/01  * For more debugging information, run "hugo -v"
ERROR: 2015/12/01 =============================================================

and warnings for all other empty pages if hugo is run in verbose mode.

Is this a sufficient solution for this issue #947? Or should more error checking and warnings be made?

Contributor

anthonyfok commented Dec 2, 2015

Hi all,

I have just pushed a commit 0d1d33d that would output a big fat error when the home page is empty:

ERROR: 2015/12/01 =============================================================
ERROR: 2015/12/01 Your rendered home page is blank: /index.html is zero-length
ERROR: 2015/12/01  * Did you specify a theme on the command-line or in your
ERROR: 2015/12/01    "config.toml" file?  (Current theme: "")
ERROR: 2015/12/01  * For more debugging information, run "hugo -v"
ERROR: 2015/12/01 =============================================================

and warnings for all other empty pages if hugo is run in verbose mode.

Is this a sufficient solution for this issue #947? Or should more error checking and warnings be made?

@SvenDowideit

This comment has been minimized.

Show comment
Hide comment
@SvenDowideit

SvenDowideit Dec 3, 2015

Contributor

When using hugo to generate html files that are then uploaded to s3, it would be better to be able to stop these from being written to disk at all - they cause a 200 blank page, and prevent the 404 handler from showing the user something useful.

Contributor

SvenDowideit commented Dec 3, 2015

When using hugo to generate html files that are then uploaded to s3, it would be better to be able to stop these from being written to disk at all - they cause a 200 blank page, and prevent the 404 handler from showing the user something useful.

bramp added a commit to bramp/hugo that referenced this issue Dec 17, 2015

Print error when /index.html is zero-length
Also print warning (in verbose mode) for other empty pages.

See gohugoio#947

@moorereason moorereason modified the milestones: future, v0.16 May 7, 2016

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Feb 28, 2017

Member

This issue has been automatically marked as stale because it has not been commented on for at least four months.

The resources of the Hugo team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still valuable, please open a proposal at https://discuss.gohugo.io/.

This issue will automatically be closed in four months if no further activity occurs. Thank you for all your contributions.

Member

bep commented Feb 28, 2017

This issue has been automatically marked as stale because it has not been commented on for at least four months.

The resources of the Hugo team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still valuable, please open a proposal at https://discuss.gohugo.io/.

This issue will automatically be closed in four months if no further activity occurs. Thank you for all your contributions.

@bep bep added the Stale label Feb 28, 2017

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Mar 1, 2017

Member

Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.

If this is a bug and you can still reproduce this error on the latest release or the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.

Member

bep commented Mar 1, 2017

Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.

If this is a bug and you can still reproduce this error on the latest release or the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Mar 6, 2017

FWIW I'm getting zero logs for corresponding empty pages, I can't seem to set an explicit layout either, so I just get blank pages with no explanation. A 404 would at least be better, not really sure what's going on, I don't have an empty template etc.

Ideally in development dumping a list (or logging) of the attempted layouts would be really helpful, it's really hard to debug and makes it more difficult to learn Hugo. I keep finding cases that seem like they should work just fine, but lead to resolving to the wrong template or nothing at all.

tj commented Mar 6, 2017

FWIW I'm getting zero logs for corresponding empty pages, I can't seem to set an explicit layout either, so I just get blank pages with no explanation. A 404 would at least be better, not really sure what's going on, I don't have an empty template etc.

Ideally in development dumping a list (or logging) of the attempted layouts would be really helpful, it's really hard to debug and makes it more difficult to learn Hugo. I keep finding cases that seem like they should work just fine, but lead to resolving to the wrong template or nothing at all.

@bep bep closed this May 13, 2017

tychoish added a commit to tychoish/hugo that referenced this issue Aug 13, 2017

Print error when /index.html is zero-length
Also print warning (in verbose mode) for other empty pages.

See gohugoio#947
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment