July 1st, 2024

Writing HTML by hand is easier than debugging your static site generator

The blog author discusses challenges of static site generators versus manual HTML coding, citing setup complexities and advocating for simplicity, stability, and control in website management. Emphasizes static data benefits.

Read original articleLink Icon
Writing HTML by hand is easier than debugging your static site generator

The author of the blog "the logic grimoire" reflects on the challenges of using a static site generator compared to hand-coding HTML. They express frustration with the complexities of setting up and maintaining a site generator, highlighting issues with system dependencies and configurations. The author argues that maintaining a website as a folder of HTML files offers simplicity and ease of use, especially when transitioning to new environments. They emphasize the benefits of static data over dynamic code for long-term maintenance, advocating for validated formats to avoid constant changes and potential breakages. The preference for manual HTML coding is driven by the desire to have more control and stability in website management. The post originated from a discussion on Mastodon.

Related

The demise of the mildly dynamic website (2022)

The demise of the mildly dynamic website (2022)

The evolution of websites from hand-crafted HTML to PHP enabled dynamic web apps with simple deployment. PHP's decline led to static site generators replacing mildly dynamic sites, shifting to JavaScript for features like comments.

Curating my corner of the Internet with a freehand web editor

Curating my corner of the Internet with a freehand web editor

The article reflects on the decline of personal websites in favor of commercial platforms, advocating for unique web design. It discusses limitations of current tools and introduces Hotglue as a freehand web editor promoting creativity and individuality.

Exposition of Front End Build Systems

Exposition of Front End Build Systems

Frontend build systems are crucial in web development, involving transpilation, bundling, and minification steps. Tools like Babel and Webpack optimize code for performance and developer experience. Various bundlers like Webpack, Rollup, Parcel, esbuild, and Turbopack are compared for features and performance.

Surfing the (Human-Made) Internet

Surfing the (Human-Made) Internet

The internet's evolution prompts a return to its human side, advocating for personal sites, niche content, and self-hosted platforms. Strategies include exploring blogrolls, creating link directories, and using alternative search engines. Embrace decentralized social media and RSS feeds for enriched online experiences.

Microfeatures I love in blogs and personal websites

Microfeatures I love in blogs and personal websites

The article explores microfeatures for blogs and websites inspired by programming concepts. It highlights sidenotes, navigation tools, progress indicators, and interactive elements to improve user experience subtly. Examples demonstrate practical implementations.

Link Icon 42 comments
By @numlocked - 4 months
I almost agree. The thing that keeps me coming back to static site generators is HTML partials. Having a header.html file that defines my navigation, that I can edit once and include everywhere, is why I pay the complexity tax.

And since I'm already there, I do also like scss + file watching / hot reloading. Though would happily live without it, if there was a 'native' solution to e.g.

   <html>
   <% include './header.html'>
   <body>
   ...
   </body>
   <% include './footer.html'>
   </html>
By @mikae1 - 4 months
> I am on the threshold of believing “actually just writing HTML by hand is probably easier”

Might be true until you need to create those lovely RSS feeds by hand…

> Do you enjoy debugging programming language installations? What about the language’s package ecosystem?

No and that is why I switched from Jekyll to the single binary SSG Hugo. Zola works the same way, single binary.

By @dewey - 4 months
After many years of using Hugo as a static site generator and moving my blog from blogging software to blogging software over the years I realized:

- It's fun to play around with static site generators as a technical person

- It's very annoying to actually write content (As you link images by using the file name, no nice editing interface, using a markdown editor is clunky as features of the blogging software (Embedded videos tags etc.) are not supported

- It's impossible for non-technical people to use it. My main reason why I would never introduce a static site generator for documentation at work again.

- You still need some kind of tooling to generate RSS feeds, sitemaps, pagination, so I've settled on https://getkirby.com for now which has a nice editor interface but is file based and doesn't need a database. Makes it easy to backup and move between hosts if needed.

By @zeroCalories - 4 months
Static site generators are so simple and powerful it blows my mind that anyone would suggest plain html is a suitable replacement unless your site is like 5 pages. They're so simple to build too, so if you're miffed about bloat you could throw together a simple md -> html system in a few hours, if not minutes.
By @bachmeier - 4 months
Static site generators vary greatly in complexity. I typically use a Makefile or Bash script that calls Pandoc for all the markdown pages. Also, writing html by hand is not really necessary in any circumstance. You can write the markdown directly in the html files, use a CDN for markdown conversion, and you're done.

The author is referring to a particular generator, which I agree can be a ridiculous process.

By @coldcode - 4 months
Really, my art site has 1600 detail pages, and I wrote my own site generator (in Swift) for it. You think I would want to write all of them by hand?

Sure, I could have a dynamic site (ROR, or Express or whatever) but static is easier to serve, and changes are quickly diffed except once a month when the structure is updated.

If was just doing a small site, sure, but anything substantial requires something better.

By @jppope - 4 months
Static site generators are very simple... so not really understanding what they are getting at. And for all the people who seem to struggle with writing markdown files or using a static site generator check out pagescms: https://pagescms.org/
By @tasuki - 4 months
How do you maintain the common parts then?

I don't know about your static generators, but my 40 lines of bash are very easy to debug!

By @adriangrigore - 4 months
I only created https://mkws.sh/ for duplication and templates. Those are the only problems it solves. I think it's portable enough.
By @shepherdjerred - 4 months
Astro [0] a relatively new static site generator. It solves all of the issues I've had with SSG's that feel heavy, like Gatsby.

Astro is only as complex as you make it. It lets you write JSX-like syntax that compiles to static HTML. I use it for my personal site.

[0]: https://astro.build/

[1]: https://sjer.red/

[1]: (source code) https://github.com/shepherdjerred/sjer.red

By @Ancapistani - 4 months
Generally speaking, all I really want from an SSG is to be able to keep my pages in a format that's more readable than raw HTML. A few years ago, that was reStructured Text. Since then, it's been Markdown. Shortly after CommonMark came out I converted all of my ReST docs to it, and haven't looked back.

Theming, shared blocks, etc. are all handled just fine by using includes. If those are stored in Jinja2 templates or HTML files that use SSIs is pretty irrelevant to me.

As long as I can write in Markdown, I'm happy.

By @modernerd - 4 months
> "Do you enjoy debugging programming language installations? What about the language’s package ecosystem? What about the language’s deployment model (or lack thereof)?"

Switching to a generator that ships as a single binary largely resolved this for me.

With https://www.getzola.org and similar you only need worry about installing the same version as the one that's building your site in production.

By @skgough - 4 months
For simple static sites with repetitive sections I don't want to write by hand, I find that building a simple generator in Ruby with ERB templates that loop over the rows in a SQLite table is the simplest way to do this. There's no dependencies to pull in, the ERB templates are already pretty close to HTML already, and there are plenty of GUI tools for SQLite files that make it easy to add rows by hand.
By @grishka - 4 months
I'm surprised no one mentioned Dreamweaver here. It's technically a "static site generator" as well but without any of the problems that the author is talking about. You make templates, you make pages that substitute things into the templates, you generate a bunch of html pages, done. All with a nice GUI, live preview and optional wysiwyg.
By @dclowd9901 - 4 months
I’ve been seeing a lot of these kinds of posts and sentiments lately.

Yes, it _is_ easier to write plain ol HTML. But how do you handle consistency by hand writing each page? How do you scale your site or add * number of posts or headers and footers that do things like show the latest post? If you update a link somewhere, how do you ensure all the links pointing to it are valid?

We don’t do these things because we’re masochistic. We do them because they, on the net, make things easier. I suspect this sentiment is some kind of new version of the Eternal September, where people previously unexposed to the hardships of creating functional websites think we somehow missed something in our slow march toward where we are now.

I happen to have a hand built static site. It had two pages. When I built the second page, I took the first html file, copy pasted it into a new path and made the changes. That works splendidly for a two page site. But most sites are not this way, I imagine.

By @justinmayer - 4 months
As the maintainer of the Python-based Pelican static site generator for over a decade, I can say with confidence that my experience has been nothing like what is described in this article.

Most of Pelican’s code was written by other people, and yet I have spent almost zero time debugging that code, much less my own. After taking advantage of Pelican’s rich plugin ecosystem and adding a handful of useful plugins, I continue to be amazed by how much time this publishing system saves me, and how little time I must spend to keep everything running smoothly.

What it would take to accomplish this by writing HTML by hand instead… I simply can’t fathom it. But once again, that’s just one person’s experience, and YMMV.

[0]: https://getpelican.com

By @freedomben - 4 months
If you're an Elixir person, the last year or two has had some interesting developments. For example Vox[1]. There's also a nice roll-your-own SSG using Phoenix[2]. I don't know why Elixir-based SSGs seem to die out quickly, but hopefully something will stick!

[1]: https://github.com/geolessel/vox

[2]: https://fly.io/phoenix-files/crafting-your-own-static-site-g... - HN: https://news.ycombinator.com/item?id=40850021

By @iveqy - 4 months
The beauty with a static site is that if you have a copy of the generated output, using the site generator becomes optional. You can always move away from using it (but not moving back).

This means that a "custom buggy sitegenerator" is never a bad dependency to have.

By @simonw - 4 months
> This becomes obvious when you eg get a new work machine and need to set up the site generator on the new machine and realize that the exact series of bits you had on disk on the old machine were different than what you can achieve on the new machine. And as a result the site generator doesn’t work even though the setup is “the same”

That's why I never use ANY tools like this without getting them working in something like GitHub Actions (which is effectively free these days, and all the good LLMs know how to write YAML workflow files for it.)

If you outsource the running of these tools to a CI service you don't have to worry about setting them up on new machines.

By @_heimdall - 4 months
I'm happy to hand author a small site, but the line for me has been around 3 or 4 pages before I reach for one templating engine or another.

For something like a marketing site, the homepage is usually custom enough that you wouldn't repeat yourself much. Throw in an about us or contact page and you'll be fine. Much past that and I want partials for basics like the header and footer, and likely a few layout components.

Debugging a static site generator should be a thing in my opinion. When you gave to debug an SSG it's because the tool has to much magic built into it like automatic data pipelines, opinionated front-matter schemas, etc.

By @err4nt - 4 months
If there was a code editor that _actually_ supported the HTML language as it's specified, and allowed you to select by element in the editor as well - that would be amazing.

Right now the problem I have is that text that's been marked up as HTML suddenly then becomes harder to wrangle around than it was to put it into HTML in the first place.

I want an editor where I can "select all <p>" or "search and replace all <h2> tag names with <h1> tag names while leaving attributes intact" and other ways of reasoning about HTML as HTML in my editor.

By @dheera - 4 months
Similarly, I find jQuery refreshingly easy and simple compared to React.
By @bogwog - 4 months
Writing my own SSG was the best investment I ever made into my own sanity.

The only drawback is that I can't really help people when they ask me for an SSG recommendation since most people won't want to do the same. I recently suggested to someone that they use Jekyll (after I did a small amount of research) but reading these comments makes me worried that was a mistake lol

By @manlobster - 4 months
Generating the HTML in a container seems like a better solution than ditching the generator altogether.
By @curtisblaine - 4 months
So this good advice until you need templates, which you need if you want for example syntax highlighting (include the css and the js file which parses code). From there, it's all a nightmare of having to re-sync every template change and it becomes not worth it.
By @darkotic - 4 months
I want something that just publishes my markdown files in my Obsidian vault as a static site.
By @facorreia - 4 months
Another option is having the site generator packaged as a docker image and executed via a CI pipeline when the static files are pushed to a git server. Relying on stuff installed on a local laptop for the publishing pipeline isn't sustainable.
By @add-sub-mul-div - 4 months
For a static site I'll use Django and its admin site as a CMS because that's what I know inside out, then I'll use wget in its spider mode to get a static version of the whole site. Has worked great for simple enough sites.
By @et1337 - 4 months
If we’re talking Jekyll, I completely agree with this post. But Hugo is a single binary that runs on practically anything. And it does stuff that would be a huge pain otherwise, like generating responsive image sets.
By @notatoad - 4 months
this is one of those things that's true for the trivial case, and then quickly falls apart as soon as you add even the slightest amount of complication.

writing html by hand is easier if you post infrequently, you only post basic text content and you're the only contributor. if you're posting daily, or you're sharing photo galleries, or you're trying to manage contributions from multiple authors, or you have any styling more than the absolute most basic stylesheet, then you're going to last about a day before you start trying to automate things again.

By @greenyies - 4 months
I'm using site generator for site generator use cases...

And servers which do not have any backend. Even apache2 SSI isn't enabled by default.

A standard default templating system on static content hosters would help.

By @lorisdev - 4 months
DevContainers have solved this problem for me. If I want to update my site from a different machine, I just need to git clone and open the folder in vscode.
By @Waterluvian - 4 months
I’ve tried so many and the thing that just philosophically drives me nuts is when I want to purge it of the 80% of features I don’t want.
By @imagetic - 4 months
I've never met a Wordpress person who cared.
By @frugalmail - 4 months
Besides using a single binary static site generator that other people have mentioned, docker would solve this problem for you.
By @agentultra - 4 months
I mean... I used to do that back in 1997. Before I wrote a perl script that would generate my site from a bunch of text files. My script would also ftp the files but that was replaced by rcp.

The benefit was making sure the links all worked and common page elements like the site navigation, header, and footer were all consistent.

Many folks in that era would use an IDE like HomeSite, FrontPage, and DreamWeaver... these would have template features that you would generate your site from. These tools were very much like using my script only slow and expensive.

I do get where the author is coming from though. There are some static site generators that pack more features and require more configuration than a space command centre. I don't get the appeal of those. The key is to keep it as simple as possible.

By @KingOfCoders - 4 months
Not a joke, ChatGPT does 90% of my Hugo code.
By @smokeydoe - 4 months
Only if you use nextjs…
By @gnarbarian - 4 months
I have to agree. we have way too many layers of abstraction in front end development these days. you may be able to generate a static site quickly but good luck coming back to it after 10 years.

how many of the dependencies will still be maintained? will it still even build?

back in the day tools like jQuery were a godsend for ironing out the browser incompatibility but now standards are much better.

well supported tools like that were a great abstraction point to help simplify the codebase and provide consistent functionality in an ever changing landscape of web standards and browser compatibility.

today we have the opposite problem. we have a incomprehensible mess of middleware designed to help out in some way or another but when you add it all together you end up with a 10MB hello world with 3,000 npm dependencies.

recently I decided to write a PWA using only hand rolled HTML and JavaScript and it was a pleasure. the only dependency I had to add was Nosleep.js for safari. it was extremely satisfying compared to dealing with a more modern toolchain.