Minimum Viable Hugo
github.com
github.com
https://yawpitchroll.com/posts/hugo-probably-is-not-for-you/
After initial setup, the idea is you can edit a blog on any machine (not requiring Hugo locally). Just check out a repository, make changes and do a `git push`. All the hard work is done in a Github runner.
I wanted a simple way to be able to cut and paste screenshots into Markdown and generate a static site. Obsidian is both an excellent note taking tool and editor, so it seemed appropriate. Of course the markdown files can be edited with any editor.
[1] https://github.com/marketplace/actions/obsidian-to-hugo-page...
[3] https://blog.x1sec.com/posts/obsidian-to-hugo-github-pages-a...
Hugo has opinions on where files should be, how it should be transformed into pages. How those pages should be organized (ie: Taxonomies), and how users and template writers should be able to customize these elements to generate very different web pages.
------------
I do wonder if "Document Hugo" is the wrong approach, but instead the proper thing that needs to happen is "Create Beginner-Hugo-Template" and document that instead.
Then, "Create Intemediate-Hugo-Template" and document how various things you add to these Templates can improve a blog, or book, or various different webpage "ideas".
Add theme, follow tutorial, somehow blows up, need to figure out exactly where to put what, round and round then find a tiny wedge that works and just expand that until I have something that does what I need. But once it's set up it's really fast and you can iterate on your pages very nicely. No "tons of imports" that I needed with Jekyll.
My favorite was Hexo: Reasonably simple, default setup looked good. I wrote a larger (but still mini) review of Hexo, gostatic, and Zola: https://linsomniac.gitlab.io/post/2023-02-26-simple_static_s...
Years ago I rewrote our entire company website, including hundreds of blog posts an articles, as well as marketing stuff, in Pelican in a day or two.
When I set up my Hugo site originally, I think I spent some time munging around and eventually got it to work, but that was years ago and everything I learned is lost. So I need something dead simple. But not, unfortunately, so minimal as gostatic.
It's not python, but it is a single binary to be off and running.
edit: Forgot to mention: The install option seems to be broken, you have to go into "Reference" to the install guide to find an alternative.
Even as a dummy Product Manager, I've been able to write two plugins[0] for it over the last couple weeks (I'm one of the many laid off folks with a wee bit of extra time), and it's been a joy. Definitely frustrating moments — the docs could be better — but the maintainers have been super kind and helpful. It'd definitely benefit from a larger, more active community. Join us!
[0] Shameless plug: just last night, I wrote about one of those plugins here: https://ft.io/blog/link-preview-images/
[0]: https://www.sphinx-doc.org [1]: https://myst-parser.readthedocs.io [2]: https://myst-nb.readthedocs.io [3]: https://ablog.readthedocs.io
The docs aren't great either but didn't find them as cryptic as Hugo docs.
# What is Hugo?
`hugo` is a program that takes some .md files (ideally, conforming to a certain directory structure) and creates some .html and .xml files (conforming to another directory structure).
This is the minimal command:
# Create input directory structure to silence warnings
mkdir content layouts{,/tags,/categories}
touch layouts/home.html layouts/{categories,tags}/list.html
# Run hugo: creates public/ and resources/
hugo
…and building from there.If you read the Hugo documentation, it talks about all kinds of stuff but doesn't explain anything from the bottom up: apparently the usual way is to start with a pre-existing theme or site as template and edit it, but that's not explained anywhere either. After you eventually learn exactly what Hugo is, it becomes ok to use.
There's very few documentation experts out there. Those who write the docs are either devs who write broken English, or English majors who don't understand a lot of the tech stack. In either case, they usually miss the target persona, and what are the reader's needs.
Writing docs is hard :/.
1. An understanding of what variables are available, and where. Hugo nicely collects a lot of useful info but it is difficult to know what it all is and where it is. https://gohugo.io/variables/page/ is a good start but it is difficult to know how these are populated.
2. Hugo is implemented in Go, so under the hood everything is strongly typed. But the Hugo documentation throws that all away and presents the dynamically-typed interface that Go's html templates provides. The problem is, figuring out what anything can do is made very difficult by that. So, ok, I have a .Content or a .Data for this page... but what is that? Is it a string? Is it an object? If so, what can I do with it? I have to experiment to find out, or grep over a couple of templates to figure it out.
Honestly if I had to make just one suggestion to the Hugo docs team, it would be, strongly type your entire documentation suite. Tell me what the type of everything is, and the resulting methods/functions I can use it with. (If it's an interface, fine, I don't mean all the maximally static types necessarily.) That wouldn't fix everything, but it would fix the frustration I experience of visiting https://gohugo.io/variables/page/ and still wondering what any of that stuff actually is.
Docs are hard and thankless, but ¯\_(ツ)_/¯ them's the breaks.
How shit the product is for Wordpress is a matter of debate, but the documentation and ecosystem around it is robust enough to make it fairly easy to hack and use/abuse to do what you want it to.
Other things that I pay attention to are built-in integrations with other tools, the ability to import and export data, familiarity to users, similarity to existing tools, tutorials that leave users confident, and documentation with examples of use cases are all similar factors.
This right here is so correct! Given the option of 2 (or more) products/services, in my mind, the one with the best documentaiton wins...because it usually means it is the option that is more easy to implement...or at least i can research how to make it the esier option to implement, etc. Good docs for the win!
I got a thumbs up just a few days ago on a Confluence doc I wrote months ago explaining at a very high level what two legacy parts of our software does, from a new hire I have never met or spoken to. That really made my day.
1. Upload PicoCMS to the least expensive LAMP shared hosting, by FTP.
2. Upload markdown files to /content.
Viola.
You may also want to download themes or make your own with Twig templating system.
IMO if you're a software developer and you can't figure it out in 10 minutes, it isn't really that friendly.
If you’re ok with NPM, Metalsmith is a trivially simple static site generator, where you just write JavaScript code to customize it (and of course you can plug in templating tools). If you don’t like NPM, but like JS/TS, I started a port/rewrite of Metalsmith for Deno, I can share if anyone’s interested.
I actually made something similar except mine isn't designed for static sites specifically. It just takes markdown, parses it into HTML (with code highlighting of course) and stores the html and frontmatter in an in memory sqlite database that gets rebuilt each time you save. Not the most efficient choice, but it makes plugging it into any front end framework like nuxt or next or svelte really easy, particularly if they have server side rendering. I guess it's almost halfway between this and PicoCMS. And you get full text search.
The Show HN discussion from 2021: <https://news.ycombinator.com/item?id=29382091>
https://deno.land/x/goldsmith@1.2.1
Although I now see that I only documented in-code. It’s very similar to Metalsmith, except based on Deno, in TypeScript, async, and standarized on RegExp instead of a grab bag of globbing libraries.
Edit: generated docs link:
Hugo has many "magic" based on names, "index.md" vs "_index.md", template look up hierarchy, global variables and functions (sometimes capitalized, sometimes not; some are behind a context, some are not), etc. It's hard to tell what name is required, what is configurable, and what is just accident, until you've delved into the detailed documentation. And to make the matter more complicated, themes sometimes use name magics, too.
I also hope that Hugo can just allow piping stuff through external programs in its templates. Right now, Hugo provides a pretty large number of APIs on resource transformation, regexes, string manipulation, and hell, you can even download stuff in templates. But to be honest, it's way easier to just write a shell script.
If I were to make my own static site generator, I think I'd probably opt for less flexibility, and simpler logic, especially with regard to what file ends up where. Let the generator handle the basic MD->HTML transformation, the skeleton of the site, producing feeds and metadata. And let external programs handle everything else.
For my personal and dev sites I used to use Gatsby, but migrated to Hugo just this month: https://github.com/whyboris/homepage & https://github.com/whyboris/homepage-dev
I'm pleased with how little boilerplate Hugo actually needs. My personal websites have so few files to maintain / worry over :)
If I had more free time I would love to build a similar website for Nicholas Rescher's approach to process philosophy, that's my particular hobby horse, Rescher and maybe a little Charles Hartshorne for flavor.
While they are currently working on making this an Open Access Textbook I'm unsure what license I am allowed to attach to it. Perhaps when they coordinate with their publisher they will know better - I've been meaning to ask.
Happy to hear suggestions :)
It made me appreciate that static site generators look easy up front but are actually a huge amount of work to do right.
Here's the static site generator I wrote for my site (https://bryanpg.com): https://gist.github.com/RPGillespie6/b133854b8ebf5a983cf32c2...
I might tweak it to auto-generate the RSS xml as well at some point, that'll be another 10-20 lines tops.
> "Hugo sounds great! Let me try it out!" > "Okay, I made a new theme and a page in content/!!" > "Running hugo server -D now!!! ... Where is it!!!!"
It's not Hugo itself that is complicated, it's all the other JS and CSS dependencies that other getting started repos tend to layer in.
I will say at first its always takes a second to remember how all the folders nad files interplay, especially the `_index.md` file, but after that its super clean.
I tend to find a theme that I like that is MIT or ISC licensed, and then modify it from there to my liking. Like for the site I linked, I started with `hugo-book` but didn't like some of the coloring, so I transplanted a good chunk of Water.css into it and it looks good now.
You only really need a `config.{toml,yaml,json}` a `content` folder and a 1 file theme like the one in the article of this thread.
Everything else is just extras.
I will admit I am currently for fun working on my own static site generator, and its slowly getting pretty complex just implementing the basics. Which gives me a new appreciation for what Hugo is doing, and many other site generators.
The more generic and multi-featured you make it, the complexity just increases.
https://github.com/evansosenko/evansosenko.com
Going back to basics and having zero external dependencies is quite enjoyable. Understanding how Hugo templates, themes, and content all work together was more complicated than I originally expected, but they have build a good system. Hopefully this helps anyone looking to get started.
I did't not find yet a replacement though. One reason is that I would love to continue having markdown as the main format for creating content but somehow that is orthogonal to having that markup stored in a db backend instead of the filesystem.
it feels that between the spartan austerity of an SSG and an overengineered full-blown database-backed CMS there might be some intermediate option. or maybe not :-)
I've built a lot of Hugo sites and templates, I have 10+ open source themes at https://github.com/zerostaticthemes so here are my main observations of Hugo
* The docs do need a lot of work, but the forums and stack overflow are pretty reliable sources with Hugo having enough critical mass to get answers for even obscure errors and questions. * Hugos big problem is the Go templating language. It's arcane and unintuitive. Even after years I still find myself forgetting how to do and or conditionals. * Hugos template lookup order is opinionated but one of it's strengths. * Hugos . context is opinionated but also one of it's strengths.
If you are looking for a minimal SSG then I think it's important that it's HTML based (so no Nextjs or Gatsby) - Jekyll, Hugo and 11ty are the main options in this space but there is also a wave of new options which seem worth considering. There is a great list of ssgs over at www.staticgen.com if you want to browse the up and comers.
I have nothing to sell, but I am looking for mentors. Let me know if you have knowledge worth passing down.
An SSG especially is such a low-risk project.
Probably the most carefree code you could possibly write.
In the end I went with Markdown, Pandoc and a Makefile. Works well & I completely understand it.
$ sudo apt get install nginx
<html><head><title>Lorem ipsum dolor sit amet</title></head><body><h1>Lorem ipsum dolor sit amet</h1></body></html>
And now save it as index.html in the www directory that installing nginx creates. Check it out at http://127.0.0.1/ . Go to your router and forward port 80 to the IP address of the computer running nginx to make it public.
And like others have said, nginx comes with server side includes built in. It's the perfect amount of dynamic templating power with the minimal attack surface. Before anyone jumps in with, "but I can deploy (or other cargo cult terms) my website to a CDN if I use Hugo for templating." I question the utility and complexity of bringing in a CDN in this, minimum viable context or any personal website context.
There's a ton of value in 'just static pages', and if you do more than 1, not writing your own HTML is pretty great.
I find writing raw HTML for basic documents to be very fast and easy with a modern editor with hinting/autocomplete. Not any slower than Markdown, really.
For my actual blog I reversed the order that the first are processed. Looks okay, I think, just short on functionality (no I Tractivity).
https://www.lelanthran.com ... feedback welcome.
Glad this sorted that out.
Is it still maintained? Because all I got were incompatibilities with the newer Python versions.