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

Starting with version 2.2.0 hugo-academic does not work with RMarkdown/blogdown anymore #594

Closed
petzi53 opened this Issue Jul 17, 2018 · 16 comments

Comments

Projects
None yet
6 participants
@petzi53

petzi53 commented Jul 17, 2018

After updating several files – including blogdown and your theme – I noticed a very strange behavior. At first I couldn't determine the origin but after a rollback it turned out that with the version 2.2.0 of your theme the hugo-academic framework does not work with blogdown anymore.

I have reported in detail the error messages in a post to the RStudio community. You can reproduce the problem whenever you install a new project/website as described in your Install with RStudio description.

I am little bit surprised that I am the first user to notice this problem as I know many people are using your excellent theme with blogdown. Maybe many people did not recently update and the error does only appear in a working website after your are using the menue button "Build" -> "More…" -> "Clean All". As this is not a common procedure maybe people have not yet noticed this problem.

But with a new/clean installation, the problem can be easily reproduced.

@petzi53 petzi53 changed the title from Starting with version 2.1.0 hugo-academic does not work with RMarkdown/blogdown anymore to Starting with version 2.2.0 hugo-academic does not work with RMarkdown/blogdown anymore Jul 17, 2018

@gcushen

This comment has been minimized.

Owner

gcushen commented Jul 17, 2018

Thanks for reporting this, however it appears unrelated to the Academic code. Academic works fine when used directly with Hugo. Since the problem only occurs with Blogdown and based on your comments and the fact that Blogdown acts as a wrapper around Hugo, it would appear that there may be a bug in Blogdown. Please go ahead and submit a bug report to Blogdown if you believe that to be the case.

@petzi53

This comment has been minimized.

petzi53 commented Jul 17, 2018

Thank for your reply and sorry for bothering you. Before I reported this issue to you I checked blogdown with several other themes to see if this same issue will appear. As this was not the case I assumed it has to do with the Academic code.

I have just reported the issue to the blogdown repo. Frankly speaking, I do not know where the problem could be. Hopefully someone looks into this issue …

@yihui

This comment has been minimized.

Contributor

yihui commented Jul 17, 2018

Hi @gcushen, I guess this is still an issue related to your theme instead of blogdown, since I have problems with vanilla Hugo. Here is a reproducible example with the latest version of the academic theme (11a5d1b): exampleSite.zip

$ hugo
Building sites … ERROR 2018/07/17 15:39:11 Failed to render "_default/single.html": runtime error: invalid memory address or nil pointer dereference
ERROR 2018/07/17 15:39:11 Stack Trace:
goroutine 153 [running]:
github.com/gohugoio/hugo/hugolib.stackTrace(0x4b0, 0x4c84f07, 0x17)
	/private/tmp/hugo-20180713-68487-o4xbkl/hugo-0.44/src/github.com/gohugoio/hugo/hugolib/page.go:280 +0x76
github.com/gohugoio/hugo/hugolib.(*Site).renderForLayouts.func1(0xc420cb98a0, 0xc4201d2300)
	/private/tmp/hugo-20180713-68487-o4xbkl/hugo-0.44/src/github.com/gohugoio/hugo/hugolib/site.go:1734 +0x135
panic(0x4b4c740, 0x53664f0)
	/usr/local/Cellar/go/1.10.3/libexec/src/runtime/panic.go:502 +0x229
text/template.errRecover(0xc420cb9790)
	/usr/local/Cellar/go/1.10.3/libexec/src/text/template/exec.go:137 +0x1d4
panic(0x4b4c740, 0x53664f0)
	/usr/local/Cellar/go/1.10.3/libexec/src/runtime/panic.go:502 +0x229
text/template.errRecover(0xc420cb8af8)
	/usr/local/Cellar/go/1.10.3/libexec/src/text/template/exec.go:137 +0x1d4
panic(0x4b4c740, 0x53664f0)
	/usr/local/Cellar/go/1.10.3/libexec/src/runtime/panic.go:502 +0x229
github.com/gohugoio/hugo/hugolib.(*Page).Permalink(0x0, 0x0, 0x0)
	/private/tmp/hugo-20180713-68487-o4xbkl/hugo-0.44/src/github.com/gohugoio/hugo/hugolib/page.go:1159 +0x5
reflect.Value.call(0x4c31d60, 0xc420d9d480, 0xc693, 0x4c37879, 0x4, 0x53ab1c8, 0x0, 0x0, 0x4c2c660, 0x1, ...)
	/

$ hugo version
Hugo Static Site Generator v0.44/extended darwin/amd64 BuildDate: unknown

Another possibility is the version of Hugo on macOS is broken somehow (according to @petzi53, it is also problematic on Linux with Hugo 0.42: https://app.netlify.com/sites/test-academic2/deploys/5b4da742c965921ad296ebb5). Anyway, since the issue exists without using blogdown, I guess I should be innocent. Thanks!

@davidkane9

This comment has been minimized.

davidkane9 commented Jul 18, 2018

I have similar difficulties. But thanks for making the academic theme. It is cool!

@gcushen

This comment has been minimized.

Owner

gcushen commented Jul 18, 2018

The error provided by Hugo is not very useful :(

The preferred method for installing Academic, using the academic-kickstart repository, appears fully working and unaffected.

So the error arises when using Hugo v0.44 (and possibly some earlier versions) with the latest example site. By trial and error, deleting the 'content/tags' folder resolves the error.

@yihui

This comment has been minimized.

Contributor

yihui commented Jul 18, 2018

I just did further testing, and the problem was introduced in hugo-academic v2.3.0. I didn't bisect so I don't know which commit introduced the problem: v2.2.0...v2.3.0 V2.2.0 and previous versions worked fine.

@gcushen

This comment has been minimized.

Owner

gcushen commented Jul 18, 2018

Sorry innocent @yihui and thanks for the help debugging :) The example site is fixed now :)

It was not an issue with the Academic theme, but with the example site and how Hugo parses it.

It turns out that it's more like a bug in Hugo as Hugo obviously doesn't handle very well the mismatch of case between tags in content front matter and case of the tag name in the custom tag page folder - e.g. a tag in the front matter was renamed from "academic" to "Academic" but the folder for the custom tag page remained named "content/tags/academic/".

In my view, Hugo should really deal with this automatically, or at worst, continue the build of a site but with a friendly warning message about tag case.

Oh, and also I hope Hugo team can improve error handling generally as error/panic messages like the above do not provide very useful debugging information.

@yihui

This comment has been minimized.

Contributor

yihui commented Jul 18, 2018

@gcushen Thanks a lot! I definitely agree with you here.

@petzi53

This comment has been minimized.

petzi53 commented Jul 19, 2018

@gcushen @yihui Thank you! I just updated and everything works fine again!

@bchwtz

This comment has been minimized.

bchwtz commented Jul 22, 2018

I am still running into that error and can not get the example site to work. I tried setting the academic theme up several times via RStudio and blogdown v0.8.1, but an index file is never generated. My Hugo version is 0.45. Can someone please look into this and point me into the right direction.

@gcushen

This comment has been minimized.

Owner

gcushen commented Jul 22, 2018

@bchwtz Hugo v0.45 is a major new version which has literally only just been released and has breaking changes. Please use a supported version of Hugo <= v0.44.

@jrennstich

This comment has been minimized.

jrennstich commented Jul 23, 2018

@gcushen Thanks for pointing this out! I have been struggling with this problem the past day and couldn't find a solution. When uninstalling Hugo via hombrew and installing v0.44 via RStudio

blogdown::install_hugo(version = 0.44, use_brew = FALSE, force = TRUE)

everything seems fine. When checking which version I have installed I get

blogdown::hugo_version()
[1] ‘0.44’

Alas, same problem: index.html not found

Trying to manually install hugo in v0.44 via homebrew seemed impossible. I couldn't identity the proper homebrew-core/Formula/hugo.rb file within the corresponding version (for v0.44). Any suggestions how I can this working again?

@bchwtz

This comment has been minimized.

bchwtz commented Jul 23, 2018

For me it works after downgrading to Hugo v0.44 with blogdown v0.8.1 and academic template v2.2.0. The newest stable template release fails and the public folder won't contain an index and some other files as @jrennstich pointed out.

@gcushen Is it possible to add some sort of compatibility section in the readme page of the template to avoid such conflicts? Also is there a recommended way to update to a newer template version?

@jrennstich

This comment has been minimized.

jrennstich commented Jul 23, 2018

@bchwtz thanks for that suggestion - that would be most welcome! Do you have any advice how to check or update the academic template version?

On another note: I am using blogdown v0.8 and RStudio doesn't offer an update to v0.8.1

@gcushen

This comment has been minimized.

Owner

gcushen commented Jul 23, 2018

The latest master version of Academic on GitHub now supports Hugo v0.45 (see #601).

I have suggested to the maintainer of Hugo that proper dependency management is implemented, to prevent this kind of issue from arising again in the future.

RE Brew, I believe that the maintainer of the Hugo formula for Brew only provides one version (usually the latest) so downgrading via Brew is not possible - although as mentioned above, Hugo v0.45 is now compatible anyway.

Academic update guide (Git method is preferred since it tracks versions): https://sourcethemes.com/academic/updates/
Academic release notes (for last published update - you'll need to apply the latest master update on top of this for improved compatibility with Blogdown and Hugo v0.45): https://sourcethemes.com/academic/docs/update

Note that updates should be applied consecutively, e.g. if you're on Academic v2.1, follow the release note instructions (especially the Breaking Changes section) for v2.2 and then v2.3, rather than skipping straight to v2.3.

If you still experience errors after updating to the latest master release of Academic and following the appropriate release notes, try deleting the content/tags/ folder if it exists.

@yihui

This comment has been minimized.

Contributor

yihui commented Jul 23, 2018

@jrennstich The way you installed Hugo 0.44 was correct: blogdown::install_hugo(version = '0.44', use_brew = FALSE, force = TRUE). You don't need Homebrew in this case (and can actually brew remove hugo).

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