-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
.Render in a theme displays as blank and also fail silently for non-existent views #303
Comments
Is your source somewhere I can see it to help debug? |
Thanks for you interest @spf13, have emailed you my source separately. |
+1 same problem. Finally got most of my stuff to work, now the homepage and lists won't render anything. |
I was able to reproduce this. I believe the problem is that you aren't telling hugo which theme to use. You can do this via the command line I was able to render your site fine with If you aren't intending to publish the theme as a theme for others to use, then it's best to just place the files in $SOURCE/layout, that's the point of the $SOURCE/layout directory (as well as give you a place to customize your downloaded theme). Please confirm and close. |
Hi @spf13, no that is not the issue; I always specify the theme with I use a build script that specifies the theme and outputs to a new and empty temporary folder each time (I do this rather than --watch because hugo doesn't delete orphaned files). Since I have no 'layouts' folder, if I didn't specify the theme I get no 'index.html' generated at all. I re-tested that now. With 0.11 and no theme specified I get no index.html. With With 0.11 and '-t geekblog' and my source, do the views render for you and you get an error for the bogus view that doesn't exist? Thanks for the note about '/layouts'. I am using a theme to ensure I use good separation of theme and content. Plus, when I am happy with the theme I'll be able to share it easily. I will use my own '/layouts' for anything I can't separate or that is specific to my website/content. |
Thanks for confirming. I think I know what the issue is then. |
Great @spf13, thank you for taking another look. I think the views are a good feature that I'll use a lot. |
@whereisaaron Please confirm this fixes the issue. |
Yay! Views are back. After updating to latest code, and without changing my source the various views in my theme started rendering. Thanks for the fix @spf13. I still get no warning or errors for views than don't exist. E.g. {{ .Render "SomethingThatDefinitelyDoesNotExist" }} still silently fails and renders nothing. I am not sure what your philosophy on errors is? In my view not generating a warning or error for this is a bug. Shall I report that seperately, or do you see this behaviour as by design? |
I agree and committed a fix. |
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. |
Since switching to using a theme folder structure, I can no longer render views, they silently render as blank. I have tested with build from source and downloading 0.11.
I also realised that if I specify a view name the definitely does not exist, hugo still rendered the website without error or warning. If I change ".Render" to ".XRender" I do get an error. So it just seems to be ".Render" silently failing. Even if I am doing something wrong, I feel a missing view file should display a warning or error?
I put my (previously working) view files in every possible folders lists in the documentation (http://hugo.spf13.com/templates/views), but where '{{ .Render "summary" }}' used to work, now it silently producing blank.
Here is the section of my 'index.html' where I am trying to debug the issue. Only the hardcoded 'li' works all the ".Render" entries silently render as blank. And even though no "Bogus.html" view exists anywhere, no error or warning is displayed.
I checked the sample themes, but I notice neither of them uses views with ".Render" any more.
I tried 'hugo check' but it didn't display any warning either.
The text was updated successfully, but these errors were encountered: