Best source/examples of best practices/latest features?

As someone new to Hugo, does anyone have suggestions of the best place/theme/repo to bootstrap a site from that brings together the main examples of ‘best practice’/latest Hugo features?

I’m noticing many themes etc are not using the latest features. Understandable, but makes it harder to get rolling with the current ‘best’ of Hugo. For instance, use of the Hugo pipeline for minification, fingerprints, grouping assets with content (perhaps) and structuring themes when you’re rolling your own site etc?

Hugo docs (the source code) has been my starting point so far, but not sure how representative that is. Any pointers much appreciated!

Thanks!

J

I have one of the fastest Hugo sites, in both load and build time, and I don’t use any of those things (I also don’t use Javascript, and very little CSS…). Just giving a different perspective, on why there isn’t a concerted effort to compile a “best of Hugo” theme; Hugo is used very subjectively. :slight_smile:

1 Like

The Hugo docs are a good example. We try to eat out own dog food.

You can also check out https://regisphilibert.com/. Regis is usually on top of the latest developments and often blogs about implementing the latest features.

5 Likes

You might try downloading all the themes to a directory and searching through them for interesting elements.

Assuming Linux, but any environment should have similar capability.

Try searching the forum for a topic, grab a code snippit and grep thru the themes to find relevant files to investigate further.

For example:

fedora28 themes]# grep -r -i "minify" .
/alpha-church/layouts/partials/footer.html:{{ $util := resources.Get "js/util.js" | minify | fingerprint }}

You can also get creative with other commands like “tree” to discover layouts.

2 Likes

Thanks everyone, much appreciate the pointers and viewpoints!

J

Developers use Hugo subjectively, but that’s true of all development. I think that James (and I) want examples at a lower level. For example:

  • Creating a TOC from the directory structure. I use the menu partial from Docdock because that’s the theme I started with. It took me a long time to understand how the partial works. Is there a better way? I don’t know, and I don’t have all the time in the world to look for one.
  • Reuse: Docdock has an excerpt shortcode, but it only has full support for markdown (I use asciidoctor) and it only allows one excerpt per content file.

Final comment: Using material from themes is excruciating, because developers don’t put comments in their files.

Is it a matter of learning or communication style? @jmalin, you have two questions right there, and I’d say post them (one at a time, in consideration of volunteers’ time). Then you get the specific answers you need.

Now, from my POV, I ask: why would we cover those specific questions in a “best practice guide”? Hugo isn’t like other systems, it is really a templating engine. That means power, with less convention. And while I have no doubt popular and useful design patterns will rise to the top, the project is not working in that space at the moment. There are still tons of good ideas to be added, and that means all the practices more or less stay relevant, but the “best” is a moving target.

Here’s another way of saying it: if we could, we would curate the list of best things. As it is, we these forums and a handful of knowledge fonts talking here.

And one more point: Hugo continues to work. A best practice for a 0.18 project is still the best practice. I’m not sure if many projects encounter that phenomenon. It means whatever curated list capturing “current” features of Hugo will need to be aggressively updated. For now, I’d pay attention to #tips-tricks (you can subscribe to the feed at https://discourse.gohugo.io/c/38-tips-tricks.rss).:slight_smile:

imho the benchmark for what you are looking for is https://temp.bep.is/hugotest/ by @bep

Hmm… Note that you will possibly find the latest features in there, but that repo is very synthetic – as it is a “test bench” for my development stuff. So I would not call it best practice; also, I don’t think that repo has lots of the cool “Hugo pipes” features …