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

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

Closed
anthonyfok opened this issue Mar 5, 2015 · 11 comments
Closed

Comments

@anthonyfok
Copy link
Member

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
Copy link
Member

bep commented Mar 5, 2015

There are warning-loggings about this:

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

@anthonyfok
Copy link
Member Author

@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
Copy link
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
Copy link

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
Copy link

+1

@anthonyfok anthonyfok added this to the v0.16 milestone Dec 2, 2015
@anthonyfok anthonyfok changed the title Emit error/warning and suggested solution if a generated page is empty Print error/warning and suggest solution if a generated page is empty Dec 2, 2015
@anthonyfok anthonyfok changed the title Print error/warning and suggest solution if a generated page is empty 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
Also print warning (in verbose mode) for other empty pages.

See #947
@anthonyfok
Copy link
Member Author

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
Copy link
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.

bramp pushed a commit to bramp/hugo that referenced this issue Dec 17, 2015
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
Copy link
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
Copy link
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
Copy link

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 as completed May 13, 2017
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
Also print warning (in verbose mode) for other empty pages.

See gohugoio#947
@github-actions
Copy link

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 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants