Hugo is so strange, I’ve worked on a shortcode, and it just did not want to work.
{{- $matched := where $allSeries "Params.lostInterest" false -}}
It took me nearly an hour to find the issue! The culprit was the camelCase spelling of lostInterest. As soon as I changed it to all lower case, it worked fine. But the big catch is that for simple rendering, the value this works:
{{Params.lostInterest}}
But in the where statement, it needs to be written like this: Params.lostinterest.
Ok just did some more googling and found out now that custom parameters should always be lower case and should use snake case instead of camel case.
Comments
@peterimoore I don't think it's any worse than any of the others, I just think the others are more similar to each other. The Hugo template engine is mostly just an extension of the golang templating stuff
by hjertnes on
@hjertnes is it hard for someone to learn with no golang experience, in your opinion? The appeal of Hugo over Jekyll is the build speed and single binary, and I’d be using a pre-made theme to start with. However, I’d still want to be able to tweak and make changes if needed.
by peterimoore on
@peterimoore, I think this: seasoned developers — which I’m not — having frustration with it summarizes my expericences pretty well. In the end I was able to solve nearly all of my issues, but the way to get there needs more energy then I think it should. And I don't think I had these issues with jekyllrb. But it is just to slow when you have more then five posts in you're blog :-( And I think in the end every system has it's quirks.
by V_ on
@V_ that’s my biggest issue and hesitation with Jekyll, quite honestly. Especially when I plan on heavily posting to my blog, even though I’d simply be committing to GitHub and having Netlify do the build. Right now I’m researching Zola as a candidate instead of Jekyll/Hugo.
by peterimoore on
@peterimoore you don't need to know any golang. In the same way you don't need any ruby to use jekyll
by hjertnes on
@peterimoore any speific reason which you like from Zola? I've only had a short look at the page right now it looks rather close to Hugo from what I've seen.
by V_ on
@V_ I like that it’s a single binary like Hugo, with fast build times from being written in Rust. I’ve read a couple of posts from people using it that its template engine is much friendlier, including one who ported a theme from Jekyll in a very short time due to similarities.
by peterimoore on
@peterimoore @V_ Did I also read it has no dependencies? That has a deep appeal. I tried to manage my own SSG site in the past and depency management meant I often was trying to fix something.
by toddgrotenhuis on
@toddgrotenhuis, yes, in this regard, it's the same as Hugo. And that is certainly an aspect I like of Hugo. I don't want to remember how many times I needed to fix my ruby gems with Jekyll Oo (until I moved it into Docker, but that made it still slower).
by V_ on
@toddgrotenhuis that’s correct, and you can use it with Netlify/Vercel for serverless deploy without downloading dependencies and risking breakage. My reading also showed it has a much cleaner folder structure (than Hugo especially). I’m going to try porting a Jekyll theme.
by peterimoore on
How to respond
Write your comment on your on page and link it to this page with the following link:
https://vmac.ch/posts/2021-02-13-hugo-is-so-strange-i-ve-1613210106/
Then insert the permalink to your post into the form below and submit it.
Alternatively you can reach me by email to: comment@vmac.ch
@V_ the biggest complaint I constantly see about Hugo is the template engine being finicky and unintuitive. I considered it for my blog until I read about seasoned developers — which I’m not — having frustration with it. What has your experience been with Hugo?
by peterimoore on