chipsenkbeil / grid-side

Personal portfolio and blog for use by the Hugo generator.
MIT License
32 stars 21 forks source link

Make references to .Site.Params lowercase for compatibility with Hugo 0.17 #36

Closed driehuis closed 7 years ago

driehuis commented 7 years ago

Scenario: I'm trying to build a new site, using Hugo 0.17 and the grid-side theme at commit 8f162ae0c4f4097778ac9d7e7a873f8fb29269c5. The Params.Header section is present in the config.toml, but the home page renders without the background image, nor the user info box, as if Params.Header is not set.

The docs for Hugo say that "All Params are only accessible using all lowercase characters." After making the change in this commit, the home page renders as expected.

I'm a rank novice at both Hugo itself and the GridSide theme, so please review this pull request with all due diligence. Still trying to find out how I can convince Hugo to spit out a warning when referencing undefined data (and not holding my breath, because I think the behavior is intentional, as using the "with" clause implies the data may be absent in the first place, so this theme appears to have keeled over as a result of a semantics change in Hugo 0.17, which may or may not have been intentional).

chipsenkbeil commented 7 years ago

Hey @driehuis, thanks for bringing the incompatibilities of Hugo 0.17 to my attention. I was afraid of problems like these appearing since there's no way to lock a theme to a Hugo version and - given that the versioning is below a 1.0 release - I was expecting breaking changes to hit the theme at some point.

I'll take a look at your PR a little later this week. If there are any other changes you've seen that are necessary, feel free to create other PRs. I'm also open to adding collaborators to this project for those interested. I'll have to scour around Hugo's release notes to see if they have a transition guide for the changes since I wrote this theme for 0.14.

driehuis commented 7 years ago

Well, looks like 0.18 was released in the mean time. A quick test with 0.18 (on a different computer) showed that the backdrop image on the home page looked cropped. I have yet to figure out how to install multiple versions of hugo alongside each other for a quick comparison.

I'm looking into nightwatch.js or something similar to see if it is possible to at least detect breakage such as the fallout from the changed lowercase requirement in an automated way. I need that to have the confidence to go ahead with converting my own websites to Hugo. I have so far stuck to generating my websites from Perl templates or from Rails because I don't want to depend on software I can't safely upgrade.

There seems to be no way to specify version dependencies. In an ideal world, Hugo would know the theme is too old, and the theme would know Hugo is too young, and a separate tool could at some stage say, "hey, the combination of versions required introduces a security issue". That's how bundler and bundle-audit work together in the Ruby on Rails world, and it gives peace of mind.

At the breakneck pace Hugo is changing, perhaps the best you can do for now is to stick a line "Tested with Hugo 0.16" in the README.md.

driehuis commented 7 years ago

I cannot reproduce the "looks cropped" issue with Hugo 0.18. Even better, Hugo 0.18 works with your original template, so I'll retract my pull request as it is no longer needed.

chipsenkbeil commented 7 years ago

Thanks, @driehuis, for taking the time to look into the compatibility issues! Let me know if you find any problems. PRs are always welcome, of course!